input
10 1238099084
16 4100112380990844
26 12380990844100112380990844
42 123809908444100112380990844100112380990844
55 1238099084441001123809908441001321238099084432180990844
60 123809908444100145351123809908441001321238099084432180990844
71 12380990844410013218099084441001123809908441001321238099084432180990844
99 123809908444100180990844410013211238099084410013212380990844123809908441238099084410013232180990844
82 1238099084441001410011238099084412380990844100132123809908441238099084432180990844
58 0899809812380990844100132123809908441238099084432180990844
T = 10
for test_case in range(1, T +1):
number, num = map(str, input().split())
len_number = int(number)
# print(len_number)
# print(str(num))
# new_num = num
# stack = Stack([0]*len_number)
stack = []
# num1 = 0
# num2 = 0
for word in num:
if stack and word == stack[-1]:
stack.pop()
else:
stack.append(word)
print(f'#{test_case}', ''.join(stack))