#include <bits/stdc++.h>
using namespace std;
vector<int> adj[2 * 100005];
int n;
pair<int, int> p[100005];
int ans[2 * 100005];
void go(int ind, int c) {
  if (ans[ind]) return;
  ans[ind] = c;
  int i;
  for (i = 0; i < adj[ind].size(); i++) go(adj[ind][i], (c == 1 ? 2 : 1));
}
int main() {
  cin >> n;
  int i;
  for (i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
    adj[p[i].first].push_back(p[i].second);
    adj[p[i].second].push_back(p[i].first);
  }
  for (i = 1; i <= 2 * n; i += 2) {
    adj[i].push_back(i + 1);
    adj[i + 1].push_back(i);
  }
  for (i = 1; i <= 2 * n; i++) {
    if (!ans[i]) go(i, 1);
  }
  for (i = 0; i < n; i++)
    cout << ans[p[i].first] << " " << ans[p[i].second] << endl;
  return 0;
}
