#include <bits/stdc++.h>
using namespace std;
int n;
int A[100005], B[100005];
int main() {
  int p1 = 1, p2 = 1;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d %d", A + i, B + i);
  for (int i = 1; i <= n; i++) (A[p1] < B[p2]) ? p1++ : p2++;
  cout << string(max(p1 - 1, n / 2), '1') + string(n - max(p1 - 1, n / 2), '0')
       << endl
       << string(max(p2 - 1, n / 2), '1') + string(n - max(p2 - 1, n / 2), '0');
  return 0;
}
