#include <bits/stdc++.h>
using namespace std;
int Col[1000005], a[1000005], b[1000005], n;
vector<int> P[1000005];
void Dfs(int x, int col) {
  Col[x] = col;
  for (auto v : P[x]) {
    if (!Col[v]) Dfs(v, 3 - col);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    P[a[i]].push_back(b[i]);
    P[b[i]].push_back(a[i]);
  }
  for (int i = 1; i < n * 2; i += 2) {
    P[i].push_back(i + 1);
    P[i + 1].push_back(i);
  }
  for (int i = 1; i <= n * 2; i++)
    if (!Col[i]) Dfs(i, 1);
  for (int i = 1; i <= n; i++) printf("%d %d\n", Col[a[i]], Col[b[i]]);
}
