#include <bits/stdc++.h>
using namespace std;
const long long maxN = 1000011;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
long long n;
long long a[maxN], b[maxN], res[maxN];
vector<long long> G[maxN];
bool check[maxN];
void dfs(int u, int type) {
  if (check[u]) return;
  check[u] = true;
  res[u] = type;
  type = 3 - type;
  for (int i = 0, _a = (((int)(G[u]).size())); i < _a; ++i) dfs(G[u][i], type);
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = (1), _b = (2 * n); i <= _b; ++i) {
    check[i] = false;
    G[i].push_back(i + 1);
    G[i + 1].push_back(i);
    i++;
  }
  for (int i = (1), _b = (n); i <= _b; ++i) {
    cin >> a[i] >> b[i];
    G[a[i]].push_back(b[i]);
    G[b[i]].push_back(a[i]);
  }
  for (int i = (1), _b = (2 * n); i <= _b; ++i) dfs(i, 1);
  for (int i = (1), _b = (n); i <= _b; ++i)
    cout << res[a[i]] << " " << res[b[i]] << endl;
  return 0;
}
