#include <bits/stdc++.h>
using namespace std;
struct debugger {
  template <typename T>
  debugger& operator,(const T v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int n, a[200007], b[200007], vis[200007];
vector<int> g[200007];
void dfs(int u, int c) {
  if (vis[u]) return;
  vis[u] = c;
  for (auto v : g[u]) {
    dfs(v, c % 2 + 1);
  }
}
int main() {
  cin >> n;
  for (int i = 0; i <= n - 1; ++i) {
    cin >> a[i] >> b[i];
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
  }
  for (int i = 1; i < 2 * n; i += 2) {
    g[i].push_back(i + 1);
    g[i + 1].push_back(i);
  }
  for (int i = 1; i <= 2 * n; ++i) {
    if (!vis[i]) {
      dfs(i, 1);
    }
  }
  for (int i = 0; i <= n - 1; ++i) {
    cout << vis[a[i]] << " " << vis[b[i]] << "\n";
  }
  return 0;
}
