#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
vector<int> g[2 * N];
int color[2 * N];
vector<pair<int, int> > v;
inline int f(int x) {
  if (x == 1) return 2;
  return 1;
}
void dfs(int u, int c) {
  if (color[u]) return;
  color[u] = c;
  for (auto v : g[u]) dfs(v, f(c));
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
    v.push_back({x, y});
  }
  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]) dfs(i, 1);
  for (int i = 0; i < v.size(); i++)
    cout << color[v[i].first] << " " << color[v[i].second] << "\n";
  return 0;
}
