/* package codechef; // don’t place package name! /
import java.util.Scanner;
/ Name of the class has to be “Main” only if the class is public. */
class CodechefVCS {
public static void main(String[] args) throws java.lang.Exception {
try {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
sc.nextLine();
while (t-- > 0) {
String[] numberArray = sc.nextLine().split(" ");
String[] ignoredArray = sc.nextLine().split(" ");
String trackedArray = sc.nextLine();
int flag = 0;
for (String ch : ignoredArray) {
if (trackedArray.contains(ch)) {
flag++;
}
}
int y = Integer.parseInt(numberArray[0]) - (Integer.parseInt(numberArray[1]) + Integer.parseInt(numberArray[2]) - flag);
System.out.println(flag + " " + y);
}
} catch (Exception e) {
}
}
}