public static void main(String args[]) {
		try {
//			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			BufferedReader in;
			if (args.length > 0) {
				in = new BufferedReader(new FileReader(args[0]));
			} else {
				in = new BufferedReader(new InputStreamReader(System.in));
			}
			StringTokenizer st = new StringTokenizer(in.readLine());
			int numTokens = st.countTokens();
			int liste[] = new int[numTokens];
			for (int i = 0; i < numTokens; i++) {
				liste[i] = Integer.parseInt(st.nextToken());
			}
			liste = mergeSort(liste);
			String linje = in.readLine();
			StringBuilder sb = new StringBuilder();
			st = new StringTokenizer(linje);
			int[] ret = findMinMax(liste, Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
			linje = in.readLine();
			sb.append(ret[0]).append(" ").append(ret[1]);
			while (linje != null) {
				st = new StringTokenizer(linje);
				ret = findMinMax(liste, Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()));
				sb.append('\n').append(ret[0]).append(" ").append(ret[1]);
				linje = in.readLine();
			}
			System.out.println(sb.toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}