#include <iostream> #include <map> using namespace std; int main() { int a, b; int totalCase = 0; cin >> totalCase; while (totalCase--) { // 注意 while 处理多个 case int count = 0; cin >> count; int arr[count]; int res[count]; std: map<int, bool> flags; for (int k = 0; k < count; k++) { cin >> arr[k]; } int resId = 0; for (int k = count - 1; k >= 0; k--) { if (flags.find(arr[k]) == flags.end()) { res[resId] = arr[k]; flags[arr[k]] = true; resId++; } } cout << res[0]; for (int i = 1 ; i < resId; i ++) { cout << ' ' << res[i]; } cout << endl; } } // 64 位输出请用 printf("%lld")