#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <cmath>
#define re register
#define LL long long
#define ull unsigned LL
#define INF 100000009
using namespace std;
const LL N=1e6+100,M=2020,mod=1e9+7;
LL n,t,ans,maxn,a[N]={ 0,2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59 };
void dfs ( LL now,LL num,LL gs,LL sum )
{
if ( ( sum>maxn ) || ( sum==maxn && now<ans ) ) maxn=sum,ans=now;
for ( int i=1;i<=gs;i++ )
{
if ( 1e18/a[num]<now ) return;
now*=a[num];
if ( now>n ) return;
dfs ( now,num+1,i,sum*( i+1 ) );
}
}
int main ( )
{
scanf ( "%lld",&t );
while ( t-- )
{
ans=maxn=0;
scanf ( "%lld",&n );
dfs ( 1,1,n,1 );
printf ( "%lld %lld\n",ans,maxn );
}
return 0;
}
#include <algorithm>
#include <iostream>
#include <cstring>
#include <vector>
#include <cstdio>
#include <queue>
#include <cmath>
#define re register
#define LL long long
#define ull unsigned LL
#define INF 100000009
using namespace std;
const LL N=1e6+100,M=2020,mod=1e9+7;
bool fg,f[N];
int t,l,n,a,b,k[N];
vector < int > q[N];
bool find ( int x )
{
int len=q[x].size ( );
for ( int i=0;i<len;i++ )
{
int to=q[x][i];
if ( f[to] ) continue;
f[to]=1;
return 1;
}
return 0;
}
void put ( int a )
{
l=lower_bound ( k+1,k+1+n,ceil ( a*1.0/2 ) )-k;
for ( int i=l,to;i<=n;i++ )
{
to=lower_bound ( k+1,k+1+n,a-k[i] )-k;
if ( k[to]!=a-k[i] ) continue;
q[i].push_back ( to ),q[to].push_back ( i );
}
}
int main ( )
{
scanf ( "%d",&t );
while ( t-- )
{
memset ( f,0,sizeof ( f ) );
fg=0;
scanf ( "%d %d %d",&n,&a,&b );
for ( int i=1;i<=n;i++ ) scanf ( "%d",&k[i] ),q[i].clear ( );
sort ( k+1,k+1+n );
if ( k[n]>=a && k[n]>=b ) { printf ( "NO\n" );continue; }
put ( a ),put ( b );
for ( int i=1;i<=n;i++ )
{
if ( f[i] || find ( i ) ) continue;
else { fg=1;break; }
}
if ( !fg ) printf ( "YES\n" );
else printf ( "NO\n" );
}
return 0;
}