#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 500;
int x[N * 2], y[N * 2];
vector<int> s[N * 2];
int f[N * 2];
void dfs(int x, int col) {
  for (int i = 0; i < s[x].size(); i++) {
    int y = s[x][i];
    if (!f[y]) {
      f[y] = 3 - col;
      dfs(y, 3 - col);
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    s[x[i]].push_back(y[i]);
    s[y[i]].push_back(x[i]);
  }
  for (int i = 1; i <= n; i++) {
    s[i * 2].push_back(i * 2 - 1);
    s[i * 2 - 1].push_back(i * 2);
  }
  for (int i = 1; i <= 2 * n; i++)
    if (!f[i]) {
      f[i] = 1;
      dfs(i, 1);
    }
  for (int i = 1; i <= n; i++) {
    printf("%d %d\n", f[x[i]], f[y[i]]);
  }
  return 0;
}
