#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
vector<int> V[N];
int a[N][2], vis[N], col[N];
void dfs(int rt, int color) {
  for (int i = 0; i < V[rt].size(); i++) {
    int son = V[rt][i];
    if (vis[son]) continue;
    vis[son] = 1;
    col[son] = (3 ^ color);
    dfs(son, 3 ^ color);
  }
}
int main() {
  ios::sync_with_stdio(false);
  int n, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i][0] >> a[i][1];
    V[a[i][0]].push_back(a[i][1]);
    V[a[i][1]].push_back(a[i][0]);
  }
  for (i = 1; i < 2 * n; i = i + 2) {
    V[i].push_back(i + 1);
    V[i + 1].push_back(i);
  }
  for (i = 1; i <= 2 * n; i++) {
    if (vis[i]) continue;
    vis[i] = 1;
    col[i] = 1;
    dfs(i, 1);
  }
  for (i = 1; i <= n; i++) cout << col[a[i][0]] << " " << col[a[i][1]] << endl;
  return 0;
}
