#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
int mod = 1e9 + 7;
long long powmod(long long a, long long b) {
  long long res = 1;
  if (a >= mod) a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    if (res >= mod) res %= mod;
    a = a * a;
    if (a >= mod) a %= mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int maxn = 200010;
int col[maxn], a[maxn], b[maxn];
vector<int> g[maxn];
void dfs(int node, int c) {
  if (col[node]) return;
  col[node] = c;
  if (c == 1)
    c = 2;
  else
    c = 1;
  for (auto e : g[node]) dfs(e, c);
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  int n, i, j;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    g[a[i]].push_back(b[i]);
    g[b[i]].push_back(a[i]);
    g[2 * i - 1].push_back(2 * i);
    g[2 * i].push_back(2 * i - 1);
  }
  for (i = 1; i <= 2 * n; i++) {
    if (col[i] == 0) dfs(i, 1);
  }
  for (i = 1; i <= n; i++) {
    cout << col[a[i]] << " " << col[b[i]] << '\n';
  }
  cin.get();
  cin.get();
  return 0;
}
