Q=range(4)

def checkvects(V=[]):
        l=len(V)
        if l==4:
##RISULTATO: solo con l==2 ho soluzioni
                s=''
                for (w1, w2) in V:
                        s+='  %2d,%2d'%(w1,w2)
                print l,' '*l,s
        for i in xrange(4-l):
                for v1 in Q:
                        for v2  in [1,-1]:
                                check=1
                                for (w1, w2) in V:
                                        if not checkvw(v1, v2, w1, w2):
                                                check=0
                                                break
                                if check:
                                        checkvects(V[:]+[(v1,v2)])

def checkvw(v1, v2, w1, w2):
        check=1
        for a in Q:
                if a == 0:
                        continue
#               print '>>>', '(',v1,v2,')', ' ', '(',w1,w2,')', ((a*(v1+w1))%4), ((a*(v2+w2))%4)
                if (((a*(v1+w1))%4) == 0 and ((a*(v2+w2))%4) == 0) or \
                        (((a*(v1-w1))%4) == 0 and ((a*(v2-w2))%4) == 0):
                        check=0
                        break
        return check

checkvects()
