1434A. Finding Sasuke
// Author : RioTian
// Time : 20/10/25
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll _, n;
void solve() {
cin >> n;
int a[n + 1];
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < n; i += 2) cout << a[i + 1] << ' ' << -a[i] << ' ';
cout << endl;
}
int main() {
// freopen("in.txt", "r", stdin);
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> _;
while (_--) solve();
}
1435B. A New Technique
// Author : RioTian
// Time : 20/10/25
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 500 + 10;
int T;
int n, m, a[N][N], b[N][N], to[N * N];
bool mark[N * N];
int main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> T;
while (T--) {
cin >> n >> m;
for (int i = 0; i <= n * m; i++)
mark[i] = to[i] = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++)
cin >> a[i][j];
mark[a[i][0]] = 1;
to[a[i][0]] = i;
}
for (int i = 0; i < m; i++)
for (int j = 0; j < n; j++)
cin >> b[i][j];
for (int k = 0; k < m; k++)
if (mark[b[k][0]]){
for (int ii = 0; ii < n; ii++) {
int i = to[b[k][ii]];
for (int j = 0; j < m; j++) cout << a[i][j] << ' ';
cout << '\n';
}
break;
}
}
}