def m_add( x, y ):
    return ( x + y ) % 4

def m_sub( x, y ):
    return ( x - y ) % 4

def match( a, b, c, d, e, f ):
    if m_add( a, b ) != m_add( c, d ):
        return False
    if m_sub( a, b ) != m_add( e, f ):
        return False
    if m_sub( c, d ) != m_sub( e, f ):
        return False
    return True

for mask in range( 64 ):
    a = ( mask & 32 ) >> 5
    b = ( mask & 16 ) >> 4
    c = ( mask & 8  ) >> 3
    d = ( mask & 4  ) >> 2
    e = ( mask & 2  ) >> 1
    f = ( mask & 1  )
    
    if match( a, b, c, d, e, f ):
        print( a, b, c, d, e, f )