import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); if (n % 2 == 0) { System.out.println("2 " + (n / 2)); } else { System.out.println("1 " + (n / 2 + 1)); } while (true) { int t = sc.nextInt(); if (t != 3) { break; } int k = sc.nextInt(); int x = sc.nextInt(); if (k == 1) { System.out.println("1 " + (n + 1 - x)); } else { System.out.println("2 " + (n - x)); } } sc.close(); } }