T = int(input()) for _ in range(T): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A = [(A[i],i) for i in range(N)] A = sorted(A,key=lambda x: x[0]) C = [B[i]-A[i][0] for i in range(N)] cmax = 0 tot = 0 indmax = -1 for i in range(N): tot += C[i] if tot > cmax: cmax = tot indmax = i if cmax>0: Ind = [] for i in range(indmax+1): Ind.append(A[i][1]) Ind = sorted(Ind) ans = ["0"]*N for i in Ind: ans[i] = "1" print("".join(ans)) else: print("0"*N)