#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
/*vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> ans;
priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,greater<pair<int,pair<int,int>>>> pq;
pq.push({A[0]+B[0],{0,0}});
for(int i = 1 ; i<=N ; ++i) {
auto get = pq.top();pq.pop();
ans.push_back(get.first);
if(i== N) break;
pq.push({A[get.second.first+1]+B[get.second.second],{get.second.first+1,get.second.second}});
pq.push({A[get.second.first]+B[get.second.second+1],{get.second.first,get.second.second+1}});
}
return ans;
}*/
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> ans;
vector<int> v;
for(int i = 0 ; i<N ; ++i) {
for(int j = 0 ; j<N ; ++j) v.push_back(A[i]+B[j]);
}
sort(v.begin(),v.end());
for(int i = 0; i<N ; ++i) ans.push_back(v[i]);
return ans;
}