import java.util.*; import java.io.*; public class crabs { public static void main(String[] args) throws FileNotFoundException { Scanner fi = new Scanner(new File("crabs.in")); int _data = fi.nextInt(); for (int data = 0; data < _data; data++) { int n = fi.nextInt(); int m = fi.nextInt(); int d = fi.nextInt(); int t = fi.nextInt(); int[] crabs = new int[n]; int[] shells = new int[m]; int[] livesIn = new int[n]; int[] shellOccupants = new int[m]; boolean b[] = new boolean[m]; Arrays.fill(shellOccupants, -1); for (int i = 0; i < n; i++) { crabs[i] = fi.nextInt(); livesIn[i] = i; shellOccupants[i] = i; b[i] = true; } for (int i = 0; i < m; i++) { shells[i] = fi.nextInt(); } for (int time = 0; time < t; time++) { int[] needshell = new int[m]; Arrays.fill(needshell, -1); for (int i = 0; i < n; i++) { if (crabs[i] == -1) continue; crabs[i]++; if (!((crabs[i] >= shells[livesIn[i]] - d) && (crabs[i] <= shells[livesIn[i]]))) { shellOccupants[livesIn[i]] = -1; } } for (int i = 0; i < n; i++) { if (crabs[i] == -1) continue; if (shellOccupants[livesIn[i]] != -1) continue; int max = -1; int sn = -1; for (int j = 0; j < m; j++) { if ((shellOccupants[j] == -1) && ((crabs[i] >= shells[j] - d) && (crabs[i] <= shells[j]))) if (max == -1 || max < shells[j]) { max = shells[j]; sn = j; } } if (sn == -1) { crabs[i] = -1; continue; } if (needshell[sn] == -1) needshell[sn] = i; else if (crabs[i] > crabs[needshell[sn]]) { crabs[needshell[sn]] = -1; needshell[sn] = i; } else { crabs[i] = -1; } } for (int i = 0; i < m; i++) { if (needshell[i] == -1) continue; shellOccupants[i] = needshell[i]; livesIn[needshell[i]] = i; } } System.out.println("Data Set " + (data+1) + ":"); for (int i = 0; i < n; i++) { if (crabs[i] != -1) System.out.println(i + 1); } System.out.println(); } } }