#include <bits/stdc++.h>
using namespace std;
struct mace {
  int a, b;
} mg[100005];
int marka[200005], par[200005];
void dfs(int cvor) {
  int i, j, x, p;
  if (cvor % 2 == 1) {
    if (marka[cvor + 1] == 0) {
      marka[cvor + 1] = 3 - marka[cvor];
      dfs(cvor + 1);
    }
    p = par[cvor];
    if (marka[p] == 0) {
      marka[p] = 3 - marka[cvor];
      dfs(p);
    }
  } else {
    if (marka[cvor - 1] == 0) {
      marka[cvor - 1] = 3 - marka[cvor];
      dfs(cvor - 1);
    }
    p = par[cvor];
    if (marka[p] == 0) {
      marka[p] = 3 - marka[cvor];
      dfs(p);
    }
  }
}
int main() {
  int n, i, j, k, x, m, y;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x >> y;
    mg[i].a = x;
    mg[i].b = y;
    par[x] = y;
    par[y] = x;
  }
  for (i = 1; i <= 2 * n; i++) {
    if (marka[i] == 0) {
      marka[i] = 1;
      dfs(i);
    }
  }
  for (i = 1; i <= n; i++) {
    x = mg[i].a;
    y = mg[i].b;
    cout << marka[x] << " " << marka[y] << endl;
  }
  return 0;
}
