import java.io.*;
import java.util.*;

public class rod_vd {

	public void solve() throws IOException {
		int n = nextInt();
		int[] l = new int[n];
		int[] r = new int[n];
		int min = 0;
		for (int i = 0; i < n; i++) {
			int len = nextInt();
			int d = nextInt();
			l[i] = -d;
			r[i] = d - len;
			min = Math.min(l[i], min);
			min = Math.min(r[i], min);
		}
		for (int i = 0; i < n; i++) {
			out.println((l[i] - min + 1) + " " + (r[i] - min + 1));
		}

	}

	final String fileName = "rod_vd_".split("_")[0];

	public void run() throws IOException {
		br = new BufferedReader(new FileReader(fileName + ".in"));
		out = new PrintWriter(fileName + ".out");
		solve();
		out.close();
		br.close();
	}

	public static void main(String[] args) throws IOException {
		new rod_vd().run();
	}

	BufferedReader br;
	StringTokenizer str;
	PrintWriter out;

	String next() throws IOException {
		while (str == null || !str.hasMoreTokens()) {
			str = new StringTokenizer(br.readLine());
		}
		return str.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}