semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int a,b,c,A,B,C;              //??a,b,c???
    int i,j,t,m;                  //??????i,j,????t,m
    for(a=0;a<3;a++)
    {
        for(b=0;b<3;b++)
        {
            for(c=0;c<3;c++)
            {
                if((a+(b>a)+(c==a))==(b+(a>b)+(a>c))&&(a+(b>a)+(c==a))==(c+(c>b)+(b>a))&&a!=b&&b!=c&&c!=a)            //?????a,b,c?????
                {A=a;
                B=b;
                C=c;}
            }
        }
    }
    int s[2][3]={{1,2,3},{A,B,C}};                  //?????a,b,c??????
    for(i=0;i<2;i++)
    {
        if(s[1][i]>s[1][i+1])
        {
            t=s[1][i];
            s[1][i]=s[1][i+1];
            s[1][i+1]=t;
            m=s[0][i];
            s[0][i]=s[0][i+1];
            s[0][i+1]=m;                            //?a,b,c?????
        }
    }
    for(j=0;j<3;j++)
    {
        if(s[0][j]==1)
        cout<<"A";
        if(s[0][j]==2)
        cout<<"B";
        if(s[0][j]==3)
        cout<<"C";                           //?????a,b,c?????
    }
    return 0;
}
int main()
{
	int ass,bss,css;
	for(int a=1;a<4;a++){
		for(int b=1;b<4;b++){
			for(int c=1;c<4;c++){
				int as=(b>a)+(c==a);
				int bs=(a>b)+(a>c);
				int cs=(c>b)+(b>a);
				if(!(a<=b&&as<=bs||a<=c&&as<=cs||b<=c&&bs<=cs||b<=a&&bs<=as||c<=a&&cs<=as||c<=b&&cs<=bs)){
					ass=a,bss=b,css=c;
				}
			}
		}
	}
	if(ass>=bss&&bss>=css)cout<<"CBA"<<endl;
	if(ass>=css&&css>=bss)cout<<"BCA"<<endl;
	if(bss>=ass&&ass>=css)cout<<"CAB"<<endl;
	if(bss>=css&&css>=ass)cout<<"ACB"<<endl;
	if(css>=ass&&ass>=bss)cout<<"BAC"<<endl;
	if(css>=bss&&bss>=ass)cout<<"ABC"<<endl;
	return 0;
}
int main()
{
	int i,a,b,c;
	char x[3];
    for(a=0;a<3;a++)
	{
		for(b=0;b<3;b++)
		{
			if(b==a)continue;
		    for(c=0;c<3;c++)
			{
				if(c==a||c==b)continue;
				if(((b>a)+(c==a)==2-a)&&((a>b)+(a>c)==2-b)&&((c>b)+(b>a)==2-c))
				{
					x[a]='A';
					x[b]='B';
					x[c]='C';
					for(i=0;i<3;i++)
						cout<<x[i];
				}
			}
		}
	}
	return 0;
}
//**************************************************************************
//*???????                                                          *
//*???????????                                                  *
//*??????                                                            *
//*???2010?11?17?                                                    *
//**************************************************************************
int main()
{
	int a, b, c, i,flag = 0;                      //???????a,b,c????????????
	int sa, sb, sc;
	for (a = 1; a<= 3; a ++)
	{
		for (b = 1; b <= 3; b ++)
		{
			for (c = 1; c <= 3; c ++)
			{                                     //???????????????1?3???????
				sa = (b > a) + (c == a);
				sb = (a > b) + (a > c);
				sc = (c > b) + (b > a);           //sa,sb.sc??????????????
				if (a > b && sa < sb && b> c&& sb<sc)
				{ flag = 1;cout << "ABC";}
				if(a>c&&sa<sc&&c>b&&sc<sb)
				{ flag = 1;	cout <<"ACB";}
				if(b>a&&sb<sa&&a>c&&sa<sc)
				{ flag = 1;cout << "BAC";}
				if(b>=c&&sb<=sc&&c>=a&&sc<=sa)
				{ flag = 1; cout <<"BCA";}
				if(c>a&&sc<sa&&a>b&&sa<sb)
				{ flag = 1;cout <<"CAB";}
				if(c>b&&sc<sb&&b>a&&sb<sa)
				{ flag = 1;cout << "CBA";}               //???????????????????????????????
				if( flag == 1)break;

			}if( flag == 1)break;
		}if( flag == 1)break;
	}
			return 0;
}
int main()
{
	int a,b,c,words[4],rank[4];									//??a,b,c????????words?4??rank?4??????????????
	char  m[4];													//?????????????????
	for(a=1;a<=3;a++)											//??????
		for(b=1;b<=3;b++)								
			for(c=1;c<=3;c++)
			{
				if(a==b||a==c||b==c)  continue;					//????????continue
				m[a]='A';m[b]='B';m[c]='C';						//???????
				words[1]=(b>a)+(a==c);
				words[2]=(a>b)+(a>c);
				words[3]=(c>b)+(b>a);
				rank[a]=1;rank[b]=2;rank[c]=3;
				if(words[rank[1]]==2&&words[rank[2]]==1&&words[rank[3]]==0)
				{
				 for(int i=1;i<=3;i++)							//??????????????
					 cout<<m[i];
				}
			}
	
	return 0;
}
int main()
{ 
     int A,B,C,i;
     int ans,bns,cns;
	 int Ans,Bns,Cns;
     for(A=1;A<4;A++)
        {
           for(B=1;B<4;B++)
             {if(B==A)
                 continue;
              C=6-B-A;
               ans=(B>A)+(C==A);
			  bns=(A>B)+(A>C);
			  cns=(C>B)+(B>A);
			  if((B+bns==3)&&(A+ans==3)&&(C+cns==3))
			  {Ans=A;
			  Bns=B;
			  Cns=C;
			  }
		   }
		   }
		   
		   
		  for(i=1;i<4;i++)
		  {
			  if(i==Ans)
				  cout<<"A";
			  else if(i==Bns)
				  cout<<"B";
			  else
				  cout<<"C";
		  }
		  return 0;
	 }
int main()
{
	int a,b,c;//??????
	int true1,true2,true3;//????
	for (a=1;a<=3;a++)//????????
	{
		for (b=1;b<=3;b++)
		{
			for (c=1;c<=3;c++)
			{
				true1=(a<b)+(a==c);
				true2=(a>b)+(a>c);
				true3=(c>b)+(b>a);
				if (a>b&&b>c&&true3>true2&&true2>true1)
					cout<<"C"<<"B"<<"A";
				else if (a>c&&c>b&&true2>true3&&true3>true1)
					cout<<"B"<<"C"<<"A";
				else if (b>a&&a>c&&true3>true1&&true1>true2)
					cout<<"C"<<"A"<<"B";
				else if (b>c&&c>a&&true1>true3&&true3>true2)
					cout<<"C"<<"B"<<"A";
				else if (c>a&&a>b&&true2>true1&&true1>true3)
					cout<<"B"<<"A"<<"C";
				else if (c>b&&b>a&&true1>true2&&true2>true3)
					cout<<"A"<<"B"<<"C";
			}//????????????
		}
	}
	return 0;
}
void search();
int f[3];
int main()
{

   int i,j,k;
   for(i=1;i<4;i++)
   {
      f[0]=i;
      for(j=1;j<4;j++)
      {
          if(i==j)continue;
          f[1]=j;
          for(k=1;k<4;k++)
          {
              if(k==j)continue;
              if(k==i)continue;
              f[2]=k;
              search();
          }
      }
   }
    return 0;
}

void search()
{
    int count0=0,count1=0,count2=0,i,j;
    char a;
    if(f[1]>f[0])count0++;
    if(count0!=3-f[0])return;
    if(f[0]>f[1])count1++;
    if(f[0]>f[2])count1++;
    if(count1!=3-f[1])return;
    if(f[2]>f[1])count2++;
    if(f[1]>f[0])count2++;
    if(count2!=3-f[2])return;
    for(i=1;i<4;i++)
    {
        for(j=0;j<3;j++)
        {
            if(f[j]==i)
            {
                a=j+'A';
                cout<<a;
            }
        }
    }
    return;
}
int main()
{
	int A,B,C,a,b,c;                         //???????????????????????????
   

	for(A=1;A<=3;A++)
	{
	for(B=1;B<=3;B++)                           //???123??????????????
		{
			if(B==A)  continue;                    //???????????????????
			for(C=1;C<=3;C++)
			{
				if(A==C||B==C)   continue;
    a=(B>A)+(C==A);b=(A>B)+(A>C);c=(C>B)+(B>A);                 //???????
	

	if(A>B&&B>C&&a<b&&b<c) cout<<"CBA"<<endl;                        //????????????????????????????
	else if(A>C&&C>B&&a<c&&c<b) cout<<"BCA"<<endl;
	else if(B>A&&A>C&&b<a&&a<c)  cout<<"CAB"<<endl;
	else if(B>C&&C>A&&b<c&&c<a)  cout<<"ACB"<<endl;
	else if(C>A&&A>B&&c<a&&a<b) cout<<"BAC"<<endl;
	else if(C>B&&B>A&&c<b&&b<a) cout<<"ABC"<<endl;
             }
		}
	}


return 0;
}
int main()
{
	int A,B,C,i;
	int w[3],p[6];
	for(A=0;A<3;A++)
		for(B=0;B<3;B++)
			for(C=0;C<3;C++)
			{
				w[A]=(B>A)+(C==A);
				w[B]=(A>B)+(A>C);
				w[C]=(C>B)+(B>A);
				p[0]=A>B&&A>C&&B>C&&w[A]<w[B]&&w[B]<<w[C];
				p[1]=A>C&&C>B&&w[A]<w[C]&&w[C]<<w[B];
				p[2]=B>A&&A>C&&w[B]<w[A]&&w[A]<w[C];
				p[3]=B>C&&C>A&&w[B]<w[C]&&w[C]<w[A];
				p[4]=C>A&&A>B&&w[C]<w[A]&&w[A]<w[B];
				p[5]=C>B&&B>A&&w[C]<w[B]&&w[B]<w[A];
				if(p[1]||p[2]||p[3]||p[4]||p[5]==1)
				{
					for(i=0;i<3;i++)
					{
						if(i==A)
							cout<<"A";
						if(i==B)
							cout<<"B";
						if(i==C)
							cout<<"C";
					}
				}
						
			}
	return 0;
}
//***************************************************************************
//??????
//????????????????
//??????
//***************************************************************************
int main()
{ 
	                                           //??A,B,C?????????????m
	int a, b, c, appetiteA, appetiteB, appetiteC,l[3], m;
	char people[3] = {'A', 'B','C'}, p;
	for(appetiteA = 0; appetiteA <= 2; appetiteA++)
		for(appetiteB = 0; appetiteB <= 2; appetiteB++)
			for(appetiteC = 0; appetiteC <= 2; appetiteC++)
			{
				a = (appetiteB > appetiteA) + (appetiteC == appetiteA);
				b = (appetiteA > appetiteB) + (appetiteA > appetiteC);
				c = (appetiteC > appetiteB) + (appetiteB > appetiteA);
				if(a != b && a != c && b != c)
				{
					l[0] = a;
					l[1] = b;
					l[2] = c;
				}
             }
    for(int i = 0;i < 2; i++)
	{
		if(l[i] <l[i+1])
		{
			m = l[i];
			p = people[i];
			l[i] = l[i+1];
			people[i] = people[i+1];
			l[i+1] = m;
			people[i+1] = p;
		}
	}
	cout<<people[0]<<people[1]<<people[2]<<endl;
	return 0;
}
//**********************************
//*???3.cpp                     *
//*??????                    *
//*???2011-10-02                *
//**********************************
int main()
{
    //??????abc 
    int a;
    int b;
    int c;
    int m[3];  //????,???????? ????,???? ?3 > 2 > 1 
    for(a = 1; a <= 3; a++)
    {
          for(b = 1; b <= 3; b++)
          {
                for(c = 1; c <= 3; c++)
                {
                      if((a + (b > a) + (c == a) == 3) && (b + (a > b) + (c < a) == 3) && (c + (c > b) + (a < b) == 3))
                      {
                          m[0] = a;
                          m[1] = b;
                          m[2] = c;
                      }
                }
          }
    }
    //???????????????A?B?C 
    if(m[0] > m[1] && m[1] > m[2])
    {
            cout << "CBA";
    }
    if(m[0] < m[1] && m[1] < m[2])
    {
            cout << "ABC";
    }
    if(m[0] > m[2] && m[2] > m[1])
    {
            cout << "BCA";
    }
    if(m[0] > m[1] && m[0] < m[2])
    {
            cout << "BAC";
    }
    if(m[0] < m[1] && m[1] > m[2])
    {
            cout << "CAB";
    }
    if(m[0] > m[1] && m[1] > m[2])
    {
            cout << "CBA";
    }
    return 0;
}
//3?????????????? 
//A??B??????C??????? 
//B??A??????A??C??? 
//C????B????B?A???? 
//????????????????????? 
//???????????3??????
int main()
{
  int a=1,b=1,c=1,i=1;
  char rank[4];
  for (a=1;a<=3;a++)//the most the first
  {
     for(b=1;b<=3;b++)
	 {
	     for(c=1;c<=3;c++)
	     {
			if(((b<a)+(c==a)==(a-1))&&((a<b)+(a<c)==(b-1))&&((c<b)+(b<a)==(c-1)))
			{
					rank[a]='A';
			       rank[b]='B';
				   rank[c]='C';
				for(i=3;i>=1;i--)
					cout<<rank[i];
			}
		 }

	 }
  }
  cin.get();
  cin.get();
  cin.get();
  return 0;
}
int main()
{
	int m[3];
	for (int a=1;a<=3;a++)
		for (int b=1;b<=3;b++)
			for (int c=1;c<=3;c++)
			{
				m[0]=(b>a)+(c==a);
				m[1]=(a>b)+(a>c);
				m[2]=(c>b)+(b>a);
				if (((a-b)*(m[0]-m[1])<0)||(((a==b)&&(m[0]==m[1])))==1)
					if (((a-c)*(m[0]-m[2])<0)||(((a==c)&&(m[0]==m[2])))==1)
						if (((c-b)*(m[2]-m[1])<0)||(((c==b)&&(m[2]==m[1])))==1)
						{
							if (a<=b)
							{
								if(a<=c)
								{
								cout<<"A";
								if (b<=c)
									cout<<"B"<<"C";
								else cout<<"C"<<"B";
								}
								else cout<<"C"<<"A"<<"B";

							}
							if (b<a)
														{
															if(a<=c)

															cout<<"B"<<"A"<<"C";
															else if (b>=c)
																cout<<"C"<<"B"<<"A";
															else cout<<"B"<<"C"<<"A";



														}

						}

			}
	return 0;
}
/*
 * file    homework 8_4
 * author  ??
 * date    2010-11-18
 * description
           ???????
*/



int main()
{
	int a, b, c, t;
	int aa, bb, cc;
	for (a = 0; a <= 2; a ++)
	{
		for (b = 0; b <= 2; b ++)
        {
			for (c = 0; c <= 2; c ++)
			{
				t = 0;
				aa = (b > a) + (c == a);
				bb = (a > b) + (a > c);
				cc = (c > b) + (b > a);
				t = (a + aa == 2) + (b + bb == 2) + (c + cc == 2);
			    if (t == 3) break;
			}
			if (t == 3) break;
		}
		if (t == 3) break;
	}
	if (a > b)
		if(b > c)
			cout << "CBA" <<endl;
		else
			if (a > c)
				cout << "BCA" <<endl;
			else
				cout << "BAC" << endl;
	else
		if (a > c)
			cout << "CAB" << endl;
		else 
			if(b > c)
				cout << "ACB" << endl;
			else
				cout << "ABC" << endl;

	return 0;
}
/*
 * ????bifanliang.cpp
 * ??????
 * ?????2012 11 9
 * ??????????
 */



int main(){
	int a,b,c,i;               //???????abc??????i
	i=0;                       //i???0
	for(a=1;a<=3;a++){
		for(b=1;b<=3;b++){
			if (b==a) continue;
			c=6-a-b;           //????abc?????abc????
			if ((((b<a)+(c==a))==(a-1)) && (((a<b)+(a<c))==(b-1)) && (((c<b)+(b<a))==(c-1))){
				//????????????????
			char order[4];
			           order[a]='A';
			           order[b]='B';
			           order[c]='C';     //???????????ABC?????
			           cout <<order[3]<<order[2]<<order[1]<<endl;   //?????ABC
			           i=1;              //???????1
			           break;            //????
			}
		}
		if (i==1) break;                 //????????????
	}
	return 0;
}
int main(void)
{
	int a,b,c,i;
	char n[4];
	for(a=1;a<=3;a++)
		for(b=1;b<=3&&b!=a;b++)
		{
			c=6-a-b;
			if(a+(b>a)==3&&b+(a>b)+(a>c)==3&&c+(c>b)+(b>a)==3)
			{
				n[a]='A';n[b]='B';n[c]='C';
				for(i=1;i<=3;i++) cout<<n[i];
			}
		}
}
int main()
{int a,b,c;
a=3;b=2;c=1;
if(((b>a)+(c==a)==0)&&((a>b)+(a>c)==1)&&((c>b)+(b>a)==2))cout<<'C'<<'B'<<'A';
a=3;c=2;b=1;
if(((b>a)+(c==a)==0)&&((a>b)+(a>c)==2)&&((c>b)+(b>a)==1))cout<<'B'<<'C'<<'A';
a=2;b=3;c=1;
if(((b>a)+(c==a)==1)&&((a>b)+(a>c)==0)&&((c>b)+(b>a)==2))cout<<'C'<<'A'<<'B';
a=1;b=3;c=2;
if(((b>a)+(c==a)==2)&&((a>b)+(a>c)==0)&&((c>b)+(b>a)==1))cout<<'A'<<'C'<<'B';
c=3;b=2;a=1;
if(((b>a)+(c==a)==2)&&((a>b)+(a>c)==1)&&((c>b)+(b>a)==0))cout<<'A'<<'B'<<'C';
c=3;a=2;b=1;
if(((b>a)+(c==a)==1)&&((a>b)+(a>c)==2)&&((c>b)+(b>a)==0))cout<<'B'<<'A'<<'C';
return 0;
}
main()
{
      int a,b,c;
      char q[3];
      for(a=0;a<3;a++)
      {
                      for(b=0;b<3;b++)
                      {
                                      for(c=0;c<3;c++)
                                      {
                                                      if((((b>a)+(c==a)+a)==2)&&(((a>b)+(a>c)+b)==2)&&(((c>b)+(b>a)+c)==2)&&(a!=b)&&(b!=c)&&(c!=a))
                                                      {
                                                      q[a]='A';
                                                      q[b]='B';
                                                      q[c]='C';
                                                      printf("%c%c%c",q[0],q[1],q[2]);
                                                      }
                                      }
                      }
      } 
}
/*
 * WhoEatsMore.cpp
 *
 *  Created on: 2012-10-19
 *      Author: Cui Zhaoxiong Class4 1200012931
 */
int main(){
	int o[6][3]={{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}};//?????????a?b?c????1??a?2??b?3??c
	int i=0;
	for (;i<6;i++){
		int a=0,b=0,c=0;				//??for?????a?b?c?????
		for (int j=0;j<=2;j++){
			if (o[i][j]==1) a=j+1;
		}
		for (int j=0;j<=2;j++){
			if (o[i][j]==2) b=j+1;
		}
		for (int j=0;j<=2;j++){
			if (o[i][j]==3) c=j+1;
		}
		int p[3]={(a<b)+(c==b),(a>b)+(a>c),(c>b)+(b>a)};
		if (p[o[i][1]-1]<p[o[i][2]-1]<p[o[i][3]-1]) break;//???????????????
	}

	for (int j=0;j<=2;j++){				//??????
		if (o[i][j]==1) cout <<'A';
		if (o[i][j]==2) cout <<'B';
		if (o[i][j]==3) cout <<'C';
	}
	return 0;
}
int main()
{
	int a1,a2,b1,b2,c1,c2;//????????
	for (a1=1;a1<=3;a1++)
		for (b1=1;b1<=3;b1++)
			for (c1=1;c1<=3;c1++)
				if ((a1!=b1)&&(b1!=c1)&&(c1!=a1))
				{
					a2=(b1>a1)+(c1==a1);//???????
					b2=(a1>b1)+(a1>c1);
					c2=(c1>b1)+(b1>a1);
					if ((a1+a2==b1+b2)&&(b1+b2==c1+c2))//????
					{
						if (a1==1) cout<<'A';//???????
						if (b1==1) cout<<'B';
						if (c1==1) cout<<'C';
						if (a1==2) cout<<'A';
						if (b1==2) cout<<'B';
						if (c1==2) cout<<'C';
						if (a1==3) cout<<'A';
						if (b1==3) cout<<'B';
						if (c1==3) cout<<'C';
					}
				}
	cout<<endl;
	return 0;
}
int main()
{
	int i,j,a[3],CC1=(a[1]>a[0])+(a[2]==a[0]),CC2=(a[0]>a[1])+(a[0]>a[2]),CC3=(a[2]>a[1])+(a[2]>a[0]),b[3]={CC1,CC2,CC3},temp;
	char c[3]={'A','B','C'},t;
	for (a[0]=0;a[0]<3;a[0]++)
	{
		for (a[1]=0;a[1]<3;a[1]++)
			for (a[2]=0;a[2]<3;a[2]++)
			{
				if ((b[0]+a[0]==2)&&(b[1]+a[1]==2)&&(b[2]+a[2]==2))
				{
					for (i=0;i<3;i++)
					{
						for (j=0;j<3-i-1;j++)
							if (a[j]<a[j+1])
							{
								temp=a[j];
									t=c[j];
									a[j]=a[j+1];
									c[j]=c[j+1];
									a[j+1]=temp;
									c[j+1]=t;
							}
					}
					for (i=2;i>=0;i--) cout<<c[i];
				}
			}
	}
	return 0;
}
/*
 * ???020.cpp
 * Created on: 2012-10-14
 * Author: ???
 * ??????
 */
int main(){
	int A,B,C;              //??A B C???
	for(A=1;A<=3;A++){      //??A???
		for(B=1;B<=3;B++){  //??B???
			if (A!=B){      //?A B C????
				C = 6-A-B;     //??C???
				if ((B>A)+(C==A)+A==3 && (A>B)+(A>C)+B==3 && (C>B)+(B>A)+C==3){        //??????
					char m[3]={'A','B','C'},x;                                       //?????????X
					int a[3]={A,B,C},i,j,t;                                          //???????i j t
					for (j=0;j<2;j++)                                                //???2???
						for(i=0;i<2-j;i++)                                           //????2-j???
						if (a[i]>a[i+1])	{                                        //??????????
							t=a[i];a[i]=a[i+1];a[i+1]=t;                             //?????????????
							x=m[i];m[i]=m[i+1];m[i+1]=x;}                            //?????????
							cout<<m[0]<<m[1]<<m[2];                                  //?????
				}
			  }
			}
		  }

return 0;
}
int main()
{
	int A,B,C;
	int c1,c2,c3;
	for(A=1;A<=3;A=A+1)
		for(B=1;B<=3;B=B+1)
			for(C=1;C<=3;C=C+1)
			{
				c1=(B>A)+(C+A);
				c2=(A>B)+(A>C);
				c3=(C>B)+(B>A);
				if(A+c1==B+c2==C+c3==3)
					break;
			}
	if(A>B)
	{
		if(B>C) cout <<"ABC" <<endl;
		else if(C>A) cout <<"CAB" <<endl;
		else cout <<"ACB" <<endl;
	}
	else
	{
		if(A>C) cout <<"BAC" <<endl;
		else if(C>B) cout <<"CBA" <<endl;
		else cout <<"BCA" <<endl;
	}
	return 0;
}
int main(){
 int A,B,C;
 int a,b,c;
 for(A=1;A<=3;A++)
  for(B=1;B<4;B++)
   for(C=1;C<4;C++){
     a=((B>A)+(C==A));
     b=((A>B)+(A>C));
     c=((C>B)+(B>A));
     if(((A>B&&a<b)||(A==B&&a==b)||(A<B&&a>b))
       +((A>C&&a<c)||(A==C&&a==c)||(A<C&&a>c))
       +((B<C&&b>c)||(B>C&&b<c)||(B==C&&b==c))==3){
      if(((A>B&&a<b)||(A==B&&a==b)||(A<B&&a>b))+((A>C&&a<c)||(A==C&&a==c)||(A<C&&a>c))+((B<C&&b>c)||(B>C&&b<c)||(B==C&&b==c))==3)
				{
					if(A>=B&&A>=C&&B>=C) printf("ABC");
					else if(A>=B&&A>=C&&C>=B)printf("BCA");
					else if(B>=A&&B>=C&&A>=C)printf("CAB");
					else if(B>=A&&B>=C&&C>=A)printf("ACB");
					else if(C>=A&&C>=B&&B>=A)printf("ABC");
					else if(C>=A&&C>=B&&A>=B)printf("BAC");
				}
     }
  }
 return 0;
}
/*A??B??????C??????? 
B??A??????A??C??? 
C????B????B?A???? 
*/
int main()
{
	int a[3] = {1,2,3}, A, B, C, s1, s2, s3;//????????1? 2? 3?si?????????
	char b[3]; //???????A? B? C
	for(int i=0; i < 3;i++)
	{
		A = a[i];
		for(int j=0; j < 2;j++)
		{
			if(j == i)
			{
				continue;
			}
			else
			{
				B = a[j];
				for(int k=0; k < 3; k++)
				{
					if(k == i&&k == j)
					{
						continue;
					}
					else
					{
						C = a[k];
						s1=(B>A)+(A==C);
						s2=(A>B)+(A>C);
						s3=(C>B)+(B>A);
						b[s1] = 'A';         //???????????????????
						b[s2] = 'B';
						b[s3] = 'C';
						if(s1 != s2&&s1 !=s3&&s2 != s3) //???????
						{
							int f=0;
							for(int l=0;l < 3; l++)
							{
								cout<<b[l];
								f++;
								if(f == 3)
									return 0;
							}
						}
					}
				}
			}
		}
	}
}
int main()
{
	int i,j,k,t,a,b,c,num[3];
	char f[3]={'A','B','C'};
	char p;
	for(a=1;a<4;a++)
		for(b=1;b<4;b++)
			if(a!=b){
				c=6-a-b;
				i=(b>a)+(c==a);
				j=(a>b)+(a>c);
				k=(c>b)+(b>a);
				if(a+i==3&&b+j==3&&c+k==3){
					num[0]=a;
					num[1]=b;
					num[2]=c;
					for(i=1;i<3;i++)
						for(j=0;j<3-i;j++)
							if(num[j]>num[j+1]){
								t=num[j];
								num[j]=num[j+1];
								num[j+1]=t;
								p=f[j];
								f[j]=f[j+1];
								f[j+1]=p;}}}
	for(i=0;i<3;i++)
		cout<<f[i];
	return 0;
}
int main()
{
	int rank[6][3]={{1,2,0},{1,0,2},{2,1,0},{2,0,1},{0,1,2},{0,2,1}};
	int a,b,c,i;
	for(i=0;i<=5;i++)
	{
		a=rank[i][0];
		b=rank[i][1];
		c=rank[i][2];
		if((b>a)+(c==a)==2-a&&(a>b)+(a>c)==2-b&&(c>b)+(b>a)==2-c)
			break;
	}
	switch(i)
	{case 0:cout<<"CAB";break;
	case 1:cout<<"BAC";break;
	case 2:cout<<"CBA";break;
	case 3:cout<<"BCA";break;
	case 4:cout<<"ABC";break;
	case 5:cout<<"ACB";break;
	default:cout<<"fuck";break;
	}
    return 0;
}
int main(){
	const char r[6][3]={
		{'A','B','C'},
		{'A','C','B'},
		{'B','A','C'},
		{'C','A','B'},
		{'B','C','A'},
		{'C','B','A'}
 	};	
	const int n[6][3]={
		{1,1,1},
		{1,1,-1},	
		{-1,1,1},
		{1,-1,-1},
		{-1,-1,1},
		{-1,-1,-1} 
 	};	
	int nn[3][3]={{-1,2,0},{1,1,2},{-1,2,-1}},is,i;
	for(i=0;i<6;i++){
		is=1;
		int l[3]={0,0,0},L[3]={0,0,0};
		for(int j=0;j<3;j++){
			for(int p=0;p<3;p++){
				if(nn[p][j]==n[i][j]||!nn[p][j])
					l[p]++;
			}
		}
		if(l[0]>=l[1])
			L[0]=1;
		else
			L[0]=-1;
		if(l[1]>=l[2])
			L[2]=1;
		else 
			L[2]=-1;
		if(l[0]>=l[2])
			L[1]=1;
		else
			L[1]=-1;
		for(int w=0;w<3;w++){
			if(L[w]!=n[5-i][w]){
				is=0;
			}
 		}
		if(is==1){
			for(int x=0;x<3;x++)
				cout<<r[i][x];
                  break;
		}
	}
}
int main()

{

	int i,j,a[4]={0},words[4]={0};

	char b[4]={'0','A','B','C'};

	for(a[1]=1;a[1]<=3;a[1]++)

	{

		for(a[2]=1;a[2]<=3;a[2]++)

		{

			a[3]=6-a[1]-a[2];

			words[1]=(a[2]>a[1])+(a[1]==a[3]);

			words[2]=(a[1]>a[2])+(a[1]>a[3]);

			words[3]=(a[3]>a[2])+(a[1]<a[2]);

			if(a[1]==a[2]||a[1]==a[3]||a[2]==a[3])

				continue;

			if((a[1]+words[1]!=3)||(a[2]+words[2]!=3)||(a[3]+words[3]!=3))

				continue;

			for(i=1;i<=3;i++)

			{

				for(j=0;j<=3;j++)

				{

					if(a[j]==i)

						cout<<b[j];

				}

			}

		}

	}


			return 0;
}
/*
 * 1.cpp
 *
 *  Created on: 2012-10-8
 *      Author: Lixurong
 */


int get( char a, char s[] );

int main()
{
	char s[6][4]={"ABC", "ACB", "BAC", "BCA", "CAB", "CBA"}; //?????
	for( int i=0; i<6; i++ ) //??
	{
		int x, y, z; //????
		             //??????
		x = get( 'A', s[i] ) + ( get( 'B', s[i] ) > get( 'A', s[i] ) ) + ( get( 'A', s[i] )-get( 'C', s[i] ) !=-2 && get( 'A', s[i] )-get( 'C', s[i] ) !=2 );
		y = get( 'B', s[i] ) + ( get( 'A', s[i] ) > get( 'B', s[i] ) ) + ( get( 'A', s[i] ) > get( 'C', s[i] ) );
		z = get( 'C', s[i] ) + ( get( 'C', s[i] ) > get( 'B', s[i] ) ) + ( get( 'B', s[i] ) > get( 'A', s[i] ) );
		if( x == 2 && y == 2 && z == 2 ) //??
		{
			cout << s[i];//??
			return 0;
		}
	}
	return 0;
}

int get( char a, char s[] )
{
	for( int i=0; i<3; i++ )
	{
		if( s[i] == a )
			return (2-i);
	}
}
//??????
//??????
//???2010.11.23

int main()
{
	int a = 0;
	int b = 0;
	int c = 0;

	for (a = 0; a <= 2; a ++)
		for (b = 0; b <= 2; b ++)
		{
			if (a == b)
				continue;
			for (c = 0; c <= 2; c ++)                 //??a,b,c?????
			{
				if ((a == c) || (b == c))
					continue;
				if ((((a < b) + (a == c) + a) == 2)   //????????
					&& (((a > b) + (a > c) + b) == 2)
					&& (((c > b) + (b > a) + c) == 2))
				{
					if ((a >= b) && (a >= c))         //??????
					{
						if (b >= c)
							cout << "CBA";
						else
							cout << "BCA";
					}
					if ((b >= a) && (b >= c))
					{
						if (a >= c)
							cout << "CAB";
						else
							cout << "ABC";
					}
					if ((c >= a) && (c >= b))
					{
						if (a >= b)
							cout << "BAC";
						else
							cout << "ABC";
					}
				}
			}
		}

	return 0;
}
//****************************************
//*??????                         **
//*?????? 1100012802              **
//*???2011.10.13                     **
//****************************************
int main()
{
    int a,b,c,cc1,cc2,cc3;//a?b?c????cc1?cc2?cc3???????????
	for(a = 1;a <= 3;a++)
	{
		for(b = 1;b<=3;b++)
		{
			if(b == a)
				continue;
			c = 6 - a - b;
			cc1 = a + (b > a) + (c == a);
			cc2 = b + (a > b) + (a > c);
			cc3 = c + (c > b) + (b > a);
			if(cc1 == 3 && cc2 == 3 && cc3 == 3)
			{
				if(a > b && b > c)
					cout<<"CBA";
				if(a > c && c > b)
					cout<<"BCA";
				if(b > a && a > c)
					cout<<"CAB";
				if(b > c && c > a)
					cout<<"ACB";
				if(c > a && a > b)
					cout<<"BAC";
				if(c > b && b > a)
					cout<<"ABC";
			}
		}
	}
	return 0;
}