#include <bits/stdc++.h>
using namespace std;
const int N = 200008;
int a[N], b1[N], b2[N], c[N];
int main() {
  int n, i, k, p1, p2;
  scanf("%d", &n);
  memset(a, -1, sizeof(a));
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &p1, &p2);
    b1[i] = p1;
    b2[i] = p2;
    c[p1] = p2;
    c[p2] = p1;
  }
  for (i = 1; i <= n * 2; i++)
    if (a[i] < 0) {
      a[i] = 1;
      a[i + 1] = 2;
      k = c[i + 1];
      while (a[k] < 0) {
        a[k] = 1;
        a[(k & 1) ? k + 1 : k - 1] = 2;
        k = c[(k & 1) ? k + 1 : k - 1];
      }
    }
  for (i = 1; i <= n; i++) printf("%d %d\n", a[b1[i]], a[b2[i]]);
  return 0;
}
