#include <bits/stdc++.h>
using namespace std;
const int inv = 1000000000;
const int minv = -inv;
const int max_n = 100000 + 5;
int n;
int a[max_n];
int b[max_n];
vector<int> adjl[2 * max_n];
int c[2 * max_n];
bool visited[2 * max_n] = {0};
void DFS(int vt) {
  visited[vt] = true;
  for (int i = 0; i < (int)adjl[vt].size(); ++i) {
    int nb = adjl[vt][i];
    if (not visited[nb]) {
      c[nb] = 1 - c[vt];
      DFS(nb);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
    scanf("%d", &b[i]);
    --a[i];
    --b[i];
    adjl[a[i]].push_back(b[i]);
    adjl[b[i]].push_back(a[i]);
  }
  for (int i = 0; i < n; ++i) {
    adjl[2 * i].push_back(2 * i + 1);
    adjl[2 * i + 1].push_back(2 * i);
  }
  for (int i = 0; i < 2 * n; ++i)
    if (not visited[i]) {
      c[i] = 0;
      DFS(i);
    }
  for (int i = 0; i < n; ++i) {
    printf("%d ", c[a[i]] + 1);
    printf("%d\n", c[b[i]] + 1);
  }
  return 0;
}
