#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, a[maxn], b[maxn], vis[2 * maxn], color[2 * maxn];
std::vector<int> ve[2 * maxn];
bool dfs(int cur) {
  int len = ve[cur].size();
  for (int i = 0; i < len; i++) {
    int x = ve[cur][i];
    if (color[x] == color[cur]) return false;
    if (!color[x]) {
      color[x] = 3 - color[cur];
      if (!dfs(x)) return false;
    }
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    ve[a[i]].push_back(b[i]);
    ve[b[i]].push_back(a[i]);
  }
  for (int i = 1; i <= n; i++)
    ve[2 * i - 1].push_back(2 * i), ve[2 * i].push_back(2 * i - 1);
  for (int i = 1; i <= 2 * n; i++) {
    if (color[i]) continue;
    color[i] = 1;
    dfs(i);
  }
  for (int i = 1; i <= n; i++) printf("%d %d\n", color[a[i]], color[b[i]]);
  return 0;
}
