#include <bits/stdc++.h>
using namespace std;
int i, n, x[100005], y[100005], rs[200005], e, r, t;
vector<int> lda[200005];
void dfs(int x, int color = 1) {
  rs[x] = color;
  for (auto it : lda[x])
    if (!rs[it]) dfs(it, 3 - color);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
    lda[x[i]].push_back(y[i]);
    lda[y[i]].push_back(x[i]);
    lda[2 * i].push_back(2 * i + 1);
    lda[2 * i + 1].push_back(2 * i);
  }
  for (i = 1; i <= 2 * n; ++i)
    if (!rs[i]) dfs(i);
  for (i = 1; i <= n; ++i) cout << rs[x[i]] << ' ' << rs[y[i]] << '\n';
  return 0;
}
