#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ '0');
    ch = getchar();
  }
  return f ? x : -x;
}
const int N = 1e5 + 10;
int n, a[N], b[N], col[N << 1];
vector<int> E[N << 1];
inline void add(int u, int v) { E[u].push_back((v)), E[v].push_back((u)); }
inline void Dfs(int u, int pa = 0) {
  for (int v : E[u])
    if (v ^ pa && !col[v]) col[v] = col[u] ^ 3, Dfs(v, u);
}
int main() {
  n = read();
  for (int i = (1), ed = (n); i <= ed; ++i)
    a[i] = read(), b[i] = read(), add(a[i], b[i]);
  for (int i = (1), ed = (n); i <= ed; ++i) add(2 * i - 1, 2 * i);
  for (int i = (1), ed = (n * 2); i <= ed; ++i)
    if (!col[i]) col[i] = 1, Dfs(i);
  for (int i = (1), ed = (n); i <= ed; ++i)
    printf("%d %d\n", col[a[i]], col[b[i]]);
  return 0;
}
