#include <bits/stdc++.h>
using namespace std;
int color[200001];
void dfs(vector<vector<int> >& graph, int i, int temp) {
  color[i] = temp;
  for (int j = 0; j < graph[i].size(); j++) {
    if (!color[graph[i][j]]) {
      if (temp == 1)
        dfs(graph, graph[i][j], 2);
      else
        dfs(graph, graph[i][j], 1);
    }
  }
}
int main() {
  int n;
  cin >> n;
  vector<vector<int> > graph(2 * n + 1);
  for (int i = 2; i <= 2 * n - 2; i += 2) {
    graph[i].push_back(i + 1);
    graph[i + 1].push_back(i);
  }
  graph[2 * n].push_back(1);
  graph[1].push_back(2 * n);
  vector<pair<int, int> > d(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    d[i].first = a;
    d[i].second = b;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  for (int i = 1; i <= 2 * n; i++) {
    if (!color[i]) {
      dfs(graph, i, 1);
    }
  }
  for (int i = 0; i < n; i++) {
    cout << color[d[i].first] << " " << color[d[i].second] << endl;
  }
  return 0;
}
