#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char ch;
  do {
    ch = getchar();
    if (ch == '-') f = -1;
  } while (ch < '0' || ch > '9');
  do {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  } while (ch >= '0' && ch <= '9');
  return f * x;
}
const int MAXN = 200000 + 10;
int n;
int x[MAXN], y[MAXN];
vector<int> g[MAXN];
int col[MAXN];
inline void dfs(int x, int c) {
  col[x] = c;
  for (int i = 0; i < g[x].size(); i++) {
    int v = g[x][i];
    if (!col[v]) dfs(v, 3 - c);
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    x[i] = read(), y[i] = read();
    g[x[i]].push_back(y[i]);
    g[y[i]].push_back(x[i]);
  }
  for (int i = 1; i <= n; i++) {
    g[2 * i - 1].push_back(2 * i);
    g[2 * i].push_back(2 * i - 1);
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (!col[i]) {
      dfs(i, 1);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d %d\n", col[x[i]], col[y[i]]);
}
