Jewel the Magician

Jewel is a promising magician. Recently, he has learned a technique to mesmerize his audience. Let's demystify his technique as follows:


This is a companion discussion topic for the original entry at https://toph.co/p/jewel-the-magician

Need help to figer out my mistakes.

pos=list(map(int, input().split()))
counter=[0]*3

for _ in range(int(input())):
    for i in map(int, input().split()):
        i-=1
        pos[i]^=1
        counter[i]+=pos[i]

print(' '.join(map(str, counter)))