import socket
import itertools

def solve(a,k):
    A_list = list(itertools.combinations(a,len(a)/2))
    for A in A_list:
        B = set(A) ^ set(a)
        if sum([n**k for n in A]) == sum([n**k for n in B]):
            return str(A).strip("(").strip(")").split(",")


def play(s):
     re = s.recv(1024)
     print re
     nums = re.split(" ")
     nums.sort()
     k = int(nums[0].strip())
     n = int(nums[-1].strip())
     a = [n for n in range(-2**n,2**n)]
     s.send(' '.join(solve(a,k))+"\n")

s = socket.socket(
    socket.AF_INET, socket.SOCK_STREAM)
s.connect(("52.198.217.117",6666))

while True:
    play(s)
