import java.io.*;

public class Dwite1 {
	public static void main(String[] args) throws IOException {
		String[] questions = new String[5];
		BufferedReader br = new BufferedReader(new FileReader("DATA1.txt"));
		String line="";
		String question="";
		int count = 1;
		while ((line=br.readLine())!=null) {
			if (count%2==1) {
				question=line;
				count++;
			} else if (count%2==0) {
				int index = Integer.parseInt(line);
				questions[index-1]=question;
				count++;
			}
		}
		
		BufferedWriter bw = new BufferedWriter(new FileWriter("OUT1.txt"));
		for (int i = 0; i<questions.length;i++) {
			bw.write(questions[i]);
			bw.newLine();
		}
		bw.close();
	}
}			
