#include using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int t; cin >> t; while (t--) { int n; cin >> n; vector a(n), b(n); rep(i, n) cin >> a[i]; rep(i, n) cin >> b[i]; vector p(n); iota(p.begin(), p.end(), 0); sort(p.begin(), p.end(), [&](int i, int j) { return a[i] < a[j]; }); vector suma(n + 1, 0), sumb(n + 1, 0); rep(i, n) suma[i + 1] = suma[i] + a[p[i]], sumb[i + 1] = sumb[i] + b[i]; pair ans = { -1e18, -1 }; rep(i, n + 1) { ll val = suma[n] - suma[i] + sumb[i]; if (ans.first < val) ans = { val, i }; } string s(n, '0'); rep(i, ans.second) s[p[i]] = '1'; cout << s << '\n'; } return 0; }