#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree< int, null_type, less, rb_tree_tag,
tree_order_statistics_node_update> PBDS;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define lli long long int
#define vi vector
#define mii map<int,int>
#define pqb priority_queue
#define pqs priority_queue<int,vi,greater >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) int x; cin>>x; while(x–)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//for random suffle of array code:-> shuffle(arr, arr+n, rng);
bool binary_search(lli ar[], lli s, lli e, lli key) {
while (s <= e) {
lli mid = (s + e) / 2;
if (ar[mid] == key)
return true;
else if (ar[mid] < key)
s = mid + 1;
else
e = mid - 1;
}
return false;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen(“input.txt”, “r”, stdin);
// freopen(“output.txt”, “w”, stdout);
// #endif
w(x) {
lli n, m;
cin >> n;
lli ar[n];
for (int i = 0; i < n; i++)
cin >> ar[i];
cin >> m;
sort(ar, ar + n);
lli x=0, y=INT_MAX-2;
for (lli i = 0; i < n ; i++) {
if (binary_search(ar, i+1, n - 1, m - ar[i])) {
if(abs(y-x)>abs(ar[i]-m+ar[i])){
x = ar[i];
y = m - ar[i];
}
}
}
if (x > y)
swap(x, y);
cout << "Deepak should buy roses whose prices are " << x << " and " << y << "." << endl;
}
}