#include<stdio.h> #include<cstring> #include<queue> #include<math.h> #include<algorithm> using namespace std; const int maxn=1007; int main() { int T; scanf("%d", &T); while(T--) { int n, num; scanf("%d", &n); ///优先输出大数据 priority_queue<int >que; for(int i=0; i<n; i++) { scanf("%d", &num); que.push(num); } while(que.size()) { printf("%d ", que.top()); que.pop(); } printf(" "); ///优先输出小数据 priority_queue<int, vector<int>, greater<int> >Q; for(int i=0; i<n; i++) { scanf("%d", &num); Q.push(num); } while(Q.size()) { printf("%d ", Q.top()); Q.pop(); } printf(" "); } return 0; }