import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main
(String[] args
) { Scanner scanner
= new Scanner
(System.
in); int t = scanner.nextInt();
for (int testCase = 0; testCase < t; testCase++) {
int n = scanner.nextInt();
int m = scanner.nextInt();
int k = scanner.nextInt();
int[] jellyfishValues = new int[n];
int[] gellyfishValues = new int[m];
for (int i = 0; i < n; i++) {
jellyfishValues[i] = scanner.nextInt();
}
for (int i = 0; i < m; i++) {
gellyfishValues[i] = scanner.nextInt();
}
int jellyfishIndex = n - 1;
int gellyfishIndex = m - 1;
for (int i = 0; i < k; i++) {
if (jellyfishIndex >= 0 && gellyfishIndex >= 0 && gellyfishValues[gellyfishIndex] > jellyfishValues[jellyfishIndex]) {
jellyfishValues[jellyfishIndex] = gellyfishValues[gellyfishIndex];
gellyfishIndex--;
} else {
break;
}
if (i % 2 == 0) {
jellyfishIndex--;
} else {
gellyfishIndex--;
}
}
int sum = 0;
for (int value : jellyfishValues) {
sum += value;
}
}
scanner.close();
}
}