#include
#include
using namespace std;
void roses(int A[], int N, int M){
int K;
int min_diff = INT_MAX;
for( int i = 0; i < N-1 ; i++){
for( int j = i + 1; j< N; j++ ){
if( A[i] + A[j] == M ){
K = A[j] - A[i];
if( K < 0){
K = -K;
}
min_diff = min(min_diff, K);
}
}
//cout << min_diff << endl;
}
for( int i = 0; i < N-1 ; i++){
for( int j = i + 1; j< N; j++ ){
if( A[j]>A[i]){
if( A[j] + A[i]==M && A[j]- A[i] == min_diff){
cout << "Deepak should buy roses whose prices are " << A[i] << " and " << A[j] << “.” <<endl;
}
}
else if( A[j] + A[i]==M && A[i]- A[j] == min_diff){
cout << "Deepak should buy roses whose prices are " << A[j] << " and " << A[i] << "." <<endl;
}
}
}
}
int main() {
int t;
cin >> t;
for( int i = 1; i <=t ; i++){
int n;
cin >> n;
int a[n];
for ( int i = 0; i < n; i++){
cin >> a[i];
}
int m;
cin >> m;
cin.ignore();
//cout << endl;
roses( a, n, m);
}
return 0;
}