#include <iostream>
#include <vector>
#include <set>
using namespace std;
void solve() {
int n, m, k, w;
cin >> n >> m >> k >> w;
vector<pair<int, int>> a;
a.reserve(n + m + 2);
a.push_back({ 0, 0 });
a.push_back({ w + 1, 0 });
for (int i = 0; i < n; i++) {
int x; cin >> x;
a.push_back({ x, 1 });
}
for (int i = 0; i < m; i++) {
int x; cin >> x;
a.push_back({ x, 0 });
}
sort(a.begin(), a.end());
bool sat = true;
vector<int> ans;
auto solve = [&](int i, int j, int lb, int rb) {
int rc = lb;
vector<int> tmp;
for (int p = i; p < j; p++) {
if (a[p].first > rc) {
tmp.push_back(a[p].first);
rc = a[p].first + k - 1;
}
}
int m = tmp.size(), ls = rb;
for (int p = m - 1; p >= 0; p--) {
tmp[p] = min(tmp[p], ls - k);
ls = tmp[p];
}
if (ls <= lb) sat = false;
for (int x : tmp) ans.push_back(x);
};
int t = n + m + 2;
for (int i = 0, j; i < t; i = j) {
for (j = i; j < t && a[j].second == a[i].second; j++);
if (a[i].second == 0) continue;
int lb = a[i - 1].first, rb = a[j].first;
solve(i, j, lb, rb);
}
if (!sat) cout << -1 << "\n";
else {
cout << ans.size() << "\n";
for (int x : ans) cout << x << " ";
cout << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while (t--) solve();
}