#include <bits/stdc++.h>
using namespace std;
int n;
int a[100001], b[100001];
int c[200001];
vector<int> G[200001];
void dfs(int node, int color) {
  c[node] = color;
  for (int i = 0; i < G[node].size(); i++) {
    if (!c[G[node][i]]) dfs(G[node][i], 3 - color);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> 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 (!c[i]) dfs(i, 1);
  for (int i = 1; i <= n; i++) cout << c[a[i]] << " " << c[b[i]] << "\n";
}
