输入样例:
4
3310120150912233 2 4
3310120150912119 4 1
3310120150912126 1 3
3310120150912002 3 2
2
3 4
输出样例:
3310120150912002 2
3310120150912119 1
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
class Reader {
static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
static StringTokenizer tokenizer = new StringTokenizer("");
static String nextLine() throws IOException{// 读取下一行字符串
return reader.readLine();
}
static String next() throws IOException {// 读取下一个字符串
while (!tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
return tokenizer.nextToken();
}
static int nextInt() throws IOException {// 读取下一个int型数值
return Integer.parseInt(next());
}
static double nextDouble() throws IOException {// 读取下一个double型数值
return Double.parseDouble(next());
}
}
public class Main{
public static void main(String[] args) throws IOException {
// Scanner in = new Scanner(System.in);
int n1 = Reader.nextInt();
String[][] data = new String[n1][3];
for ( int i = 0; i < n1; i++ ) {
for (int j = 0; j < 3; j++ ) {
data[i][j] = Reader.next();
}
}
// for ( String[] d1 : data ) {
// for ( String d2 : d1 ) {
// System.out.println(d2);
// }
// }
int n2 = Reader.nextInt();
String[] n = new String[n2];
for ( int i = 0; i < n2; i++ ) {
n[i] = Reader.next();
// System.out.println(n[i]);
}
for ( int i = 0; i < n2; i++ ) {
for ( int j = 0; j < n1; j++ ) {
if ( n[i].equals(data[j][1]) ) {
System.out.println(data[j][0] +" "+ data[j][2]);
}
}
}
}
}