#include<iostream>
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<cstring>
//#include<conio.h>
#include<stdlib.h>
using namespace std;
int main()
{
string s1[10000],s,fr[10000];char rev[10000][200];char c[200],o;
int i,k,t,no,j,cnt=0,flg=0,l;
cin>>t;
for(j=0;j<t;j++)
{
cin>>no;
for(i=0;i<no;i++)
{
cin>>s1[i];
//cout<<s1[i]<<endl;
s=s1[i];l=s.length()-1;k=0;
// for(k=0;k<s.length();k++)
while((k<s.length())&&(l>=0))
{
c[l]=s[k];
l--;k++;
}
//o[i]=c[0];
strcpy(rev[i],c);
//strrev(rev[i]);
string fin(rev[i]);
fr[i]=fin;
//cout<<fin<<endl;
}
sort(s1,s1+no);
sort(fr,fr+no);
i=0;
while(i<no)
{ o=s1[i][0];flg=0;
for(j=0;j<no;j++)
{
if(o==fr[j][0])
{ flg=1;//cout<<o<<endl;
fr[j][0]='-';
//s1[i][0]='-';
cnt++;
//i++;
}
}
if(flg==0&&cnt==0)
{
cout<<"The door cannot be opened."<<endl;
break;
}
i++;
}
if(flg!=0||(flg==0&&cnt==1))
cout<<"Ordering is possible."<<endl;
// cout<<s1[i]<<fr[i]<<endl;
}
//getch();
return 0;
}[quote]i got runtime SIGSEGV error.. can someone help me out?[/quote]