#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 2e5 + 7;
const int INF = 1e9 + 7;
int a[N], b[N], c, d[N], n, m, ans[N];
vector<int> E[N];
void dfs(int x, int y) {
  if (ans[x]) return;
  ans[x] = y;
  for (int i : E[x]) dfs(i, (y == 1 ? 2 : 1));
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= 2 * n; i += 2) {
    E[i].push_back(i + 1);
    E[i + 1].push_back(i);
  }
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    E[a[i]].push_back(b[i]);
    E[b[i]].push_back(a[i]);
  }
  for (int i = 1; i <= 2 * n; i++) dfs(i, 1);
  for (int i = 1; i <= n; i++) printf("%d %d\n", ans[a[i]], ans[b[i]]);
  return 0;
}
