#include <bits/stdc++.h>
using namespace std;
const int N = 201 * 1000;
int n, a[N], b[N], ans[N];
bool mark[N];
vector<int> e[N];
void dfs(int x, bool color = 0) {
  mark[x] = 1;
  ans[x] = color;
  for (auto u : e[x])
    if (!mark[u]) dfs(u, !color);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    e[a[i]].push_back(b[i]);
    e[b[i]].push_back(a[i]);
  }
  for (int i = 1; i <= 2 * n; i += 2)
    e[i].push_back(i + 1), e[i + 1].push_back(i);
  for (int i = 1; i <= 2 * n; i++)
    if (!mark[i]) dfs(i);
  for (int i = 0; i < n; i++)
    cout << ans[a[i]] + 1 << " " << ans[b[i]] + 1 << "\n";
  return 0;
}
