#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:536870912")
#pragma warning(disable : 4996)
using namespace std;
const int N = 2e5 + 100;
int to[N][2], col[N], a[N], b[N];
void dfs(int node, int c) {
  col[node] = c;
  for (int i = 0; i < 2; i++) {
    if (!col[to[node][i]]) dfs(to[node][i], 3 - c);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    a[i]--, b[i]--;
    to[a[i]][0] = b[i];
    to[b[i]][0] = a[i];
  }
  for (int i = 0; i < n; i++) {
    to[i * 2][1] = i * 2 + 1;
    to[i * 2 + 1][1] = i * 2;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (!col[i]) dfs(i, 1);
  }
  for (int i = 0; i < n; i++) {
    printf("%d %d\n", col[a[i]], col[b[i]]);
  }
  return 0;
}
