#include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1001;
int n, a[N], color[N];
vector<int> adj[N];
void dfs(int u) {
  for (auto v : adj[u])
    if (!color[v]) {
      color[v] = 3 - color[u];
      dfs(v);
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> a[i + n];
    a[i]--, a[i + n]--;
    adj[a[i]].push_back(a[i + n]);
    adj[a[i + n]].push_back(a[i]);
  }
  for (int i = 0; i < n; i++) {
    adj[2 * i].push_back(2 * i + 1);
    adj[2 * i + 1].push_back(2 * i);
  }
  for (int i = 0; i < 2 * n; i++)
    if (!color[i]) {
      color[i] = 1;
      dfs(i);
    }
  for (int i = 0; i < n; i++)
    cout << color[a[i]] << " " << color[a[i + n]] << "\n";
}
