#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
vector<int> G[MAX];
int color[MAX];
int a[MAX], b[MAX];
void dfs(int v, int c) {
  color[v] = c;
  for (int i = 0; i < G[v].size(); i++) {
    if (color[G[v][i]] != 0) continue;
    color[G[v][i]] = -c;
    dfs(G[v][i], -c);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i], &b[i]);
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  for (int i = 1; i <= 2 * n; i += 2) {
    G[i].push_back(i + 1);
    G[i + 1].push_back(i);
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (color[i]) continue;
    dfs(i, 1);
  }
  for (int i = 0; i < n; i++) {
    if (color[a[i]] == 1)
      cout << "1 2" << endl;
    else
      cout << "2 1" << endl;
  }
  return 0;
}
