#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
const int maxn = (int)2e5 + 10;
vector<int> ed[maxn];
pair<int, int> f[maxn];
bool used[maxn];
int col[maxn];
void dfs(int v, int tp = 1) {
  col[v] = tp;
  used[v] = true;
  for (int i = 0; i < (int)ed[v].size(); i++) {
    int u = ed[v][i];
    if (!used[u]) {
      dfs(u, 3 - tp);
    } else if (col[u] == tp) {
      throw 1;
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    ed[x].push_back(y);
    ed[y].push_back(x);
    f[i] = make_pair(x, y);
  }
  for (int i = 1; i <= 2 * n; i += 2) {
    ed[i].push_back(i + 1);
    ed[i + 1].push_back(i);
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (!used[i]) {
      dfs(i);
    }
  }
  for (int i = 0; i < n; i++) {
    printf("%d %d\n", col[f[i].first], col[f[i].second]);
  }
  return 0;
}
