#include #include #include #include #include using namespace std; //priority_queue,less> pq; int ans[1001000]; int main() { int i,j,k,n,m,t,lim,k1,t1; int T; scanf("%d",&t); while(t--) { T=0; scanf("%d",&n); for(i=0;i=2) break; } } if(k!=1&&j==lim+1) ans[T++]=k; } if(T<2) printf("-1\n"); else { sort(ans,ans+T); //k1=pq.top(); //pq.pop(); printf("%I64d\n",1ll*ans[0]*ans[1]); } } return 0; }