#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
vector<int> adj[N];
int a[N], b[N], col[N];
void edge(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}
void dfs(int u, int c = 1) {
  if (col[u]) return;
  col[u] = c;
  for (int v : adj[u]) dfs(v, 3 - c);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    edge(--a[i], --b[i]);
    edge(2 * i, 2 * i + 1);
  }
  for (int i = 0; i < 2 * n; i++) dfs(i);
  for (int i = 0; i < n; i++) {
    cout << col[a[i]] << ' ' << col[b[i]] << '\n';
  }
  return 0;
}
