def imp(a, b):
    return not a or b

rows = [(0,'?',0,0,0,1), (0,0,0,'?',0,'?'), (0,1,1,'?','?',0)]

for a in 'xyzw':
    for b in 'xyzw':
        for c in 'xyzw':
            for d in 'xyzw':
                if len({a, b, c, d}) < 4:
                    continue
                ok = True
                for row in rows:
                    found = False
                    for n in range(16):
                        v = {'x': n >> 3 & 1, 'y': n >> 2 & 1, 'z': n >> 1 & 1, 'w': n & 1}
                        x, y, z, w = v['x'], v['y'], v['z'], v['w']
                        t = [v[a], v[b], v[c], v[d],
                             int(imp(w, y) == imp(z, x)),
                             int(imp(w, y) and (not x) == z)]
                        match = True
                        for i in range(6):
                            if row[i] != '?' and row[i] != t[i]:
                                match = False
                        if match:
                            found = True
                    if not found:
                        ok = False
                if ok:
                    print(a + b + c + d)