#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 1e6 + 10;
const long long mod = 1e9 + 7;
const long long mod2 = 998244353;
const long long inf = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long M) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % M, b / 2, M)) % M
                      : pw(a * a % M, b / 2, M)));
}
int n, A[N], B[N], Ans[N];
vector<int> G[N];
void dfs(int v) {
  for (auto u : G[v]) {
    if (Ans[u]) continue;
    Ans[u] = 3 - Ans[v];
    dfs(u);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &A[i], &B[i]);
    G[A[i]].push_back(B[i]);
    G[B[i]].push_back(A[i]);
    int a = i << 1, b = i << 1 | 1;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  for (int i = 1; i <= n << 1; i++) {
    if (!Ans[i]) {
      Ans[i] = 1;
      dfs(i);
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d %d\n", Ans[A[i]], Ans[B[i]]);
  }
  return 0;
}
