/*
 * dazhengshujianfa.cpp
 *
 *  Created on: 2010-11-17
 *      Author: Administrator
 */
int main(){
	int n,i,j,lenth1,lenth2,carry;
	carry=0;
	cin>>n;
	char a[101],b[101],c[101];
	for(i=1;i<=n;i++){
		carry=0;
		cin>>a;
		cin>>b;
		lenth1=strlen(a);
		lenth2=strlen(b);
		for(j=lenth2;j<lenth1;j++){
			b[j]='0';
		}
		strcpy(c,a);
		for(j=1;j<=lenth2;j++){
            c[lenth1-j]=a[lenth1-j]-b[lenth2-j]-carry+'0';
			if(c[lenth1-j]-'0'<0){
				carry=1;
				c[lenth1-j]+=10;
			}
			else  carry=0;
		}
		if(lenth1>lenth2){
			if(carry==1){
				c[lenth1-lenth2-1]-=1;
			}
		}
		if(c[0]=='0')  c[0]='\0';
		for(j=0;j<lenth1;j++){
			cout<<c[j];
		}
		cout<<endl;
	}
	return 0;
}


int main()
{
	int n,i,j;
	char str1[101],str2[101];
	cin>>n;
	while(n>0)
	{
		int anlen1[100]={0,},anlen2[100]={0,};
		cin>>str1>>str2;
		int len1 = strlen(str1);
		int len2 = strlen(str2);
		j=0;
		for(i = len1-1;i >= 0;i--)
			anlen1[j++] = str1[i] - '0';
		j=0;
		for(i = len2-1;i >= 0;i--)
			anlen2[j++] = str2[i] - '0';
		for(i = 0;i < len1;i++)
		{
			if(anlen1[i] >= anlen2[i])
				anlen1[i] -= anlen2[i];
			else
			{
				anlen1[i] = anlen1[i] - anlen2[i] + 10;
				anlen1[i+1]--;
			}
		}
		i = len1-1;
		while(anlen1[i] == 0) i--;
		for(;i >= 0;i--)
			cout<<anlen1[i];
		cout<<endl;
		n--;
	}
return 0;
}


int main()
{
 int i, j ,m, n;
 scanf ("%d", &n);
 for (m=0; m<n; m++)
 {
  char a[SIZE+1]={0}, b[SIZE+1]={0};
  char carry=0;
  char a_str[SIZE+1], b_str[SIZE+1];
  char ab_minus[SIZE+1] = {0};
  int big = 0;
  scanf ("%s", a_str);
  scanf ("%s", b_str);
  for (i = strlen(a_str), j = SIZE ; i>=0 ; i--, j--)
   a[j] = a_str[i] - '0';
  for (i = strlen(b_str), j = SIZE ; i>=0 ; i--, j--)
   b[j] = b_str[i] - '0';
  for (i = SIZE-1; i>= 0; i--)
  {
   if (a[i] - carry < b[i])
   {
    a[i]+=10;
    ab_minus[i] = a[i] - b[i] - carry;
    carry = 1;
   }
   else
   {
    ab_minus[i] = a[i] - b[i] - carry;
    carry = 0;
   }
  }
  for (i=0; i < SIZE-1 && ab_minus[i] == 0; i++);
  for (; i < SIZE; i++)
   printf ("%c", ab_minus[i] + '0');
  printf ("\n");
  }
  return 0;
}


int main()
{
    int n,u,i ,Len1=0,Len2=0,max=0;
    const int MAX_LEN = 100;
    int num1[MAX_LEN+1]={0};int num2[MAX_LEN+1]={0};
    char str1[MAX_LEN + 1];char str2[MAX_LEN + 1];
    cin >> n;
    cin.get();
    for (u=0;u<n;u++)
    {
        cin.getline(str1, MAX_LEN + 1);
        cin.getline(str2, MAX_LEN + 1);
        Len1 = strlen(str1);
        Len2 = strlen(str2);
        for (i = Len1 - 1; i >= 0; i--)
        num1[Len1-1-i] =  str1[i]-'0';

        for (i = Len2 - 1;  i >= 0; i--)
        num2[Len2-1-i] =  str2[i]-'0';
        if (Len1>Len2)
        {
            max=Len1;
        }
        else
        max=Len2;

        for (i = 0; i <max; i++)
        {
             num1[i]=num1[i]- num2[i];
             if(num1[i]<0)
             {
                 num1[i]=num1[i]+10;
                 num1[i+1]=num1[i+1]-1;
             }
        }
        i = MAX_LEN;
        while (num1[i]==0)
        i--;

        for (; i >= 0; i--)
        cout << num1[i];

        cout << endl;
        for (i=0;i<MAX_LEN;i++)
        {
            num1[i]=0;
            num2[i]=0;
        }
        Len1=0;
        Len2=0;
        max=0;
        if (i!=n-1)
        cin.get();

    }
    return 0;
}


void main()
{
	int flag2,flag,j,k,lengtha,lengthb,n,i;
	char temp,a[100],b[100];
	flag=0;
	flag2=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		if (flag2) temp=getchar();
		else flag2=1;
		scanf("%s",a);
		scanf("%s",b);
		lengtha=strlen(a);
		lengthb=strlen(b);
		for (j=1;j<=lengthb;j++)
		{
			a[lengtha-j]=a[lengtha-j]-b[lengthb-j]+48;
			k=lengtha-j;
			while (a[k]<48)
			{
				a[k]=a[k]+10;
				a[k-1]--;
				k--;
			}
		}
		if (flag) printf("\n");
		else flag=1;
		printf("%s",a);

	}
}


int beijianshu[200]={0},jianshu[200]={0},cha[200]={0};
int len1,len2;
int flag;
char a[200],b[200];
void reverse(char a[],char b[])
{
	int i;
	for(i=0;i<len1;i++) beijianshu[i]=a[len1-i-1]-'0';
	for(i=0;i<len2;i++) jianshu[i]=b[len2-i-1]-'0';
}
int panduan()
{
	if (len1>len2) return 1;
	else if (len1==len2)
	{
		for(int i=0;i<len1;i++)
		{
			if(a[i]>b[i]) return 1;
			else if(a[i]<b[i]) return -1;
		}
		return 0;
	}
	else return -1;
}
void calculate()
{
	int i;
	if(flag!=0)
	{
		for(i=0;i<len1||i<len2;i++) cha[i]=beijianshu[i]-jianshu[i];
		if(flag==1)
		{
			for(i=0;i<len1;i++)
			{
				if(cha[i]<0)
				{
					cha[i+1]--;
					cha[i]+=10;
				}
			}
		}
		else
		{
			for(i=0;i<=len2;i++)
			{
				if(cha[i]>0)
				{
					cha[i]-=10;
					cha[i+1]++;
				}
			}
		}
	}
}
void print()
{
	int i;
	if(flag==0) cout<<0<<endl;
	else
	{
		for(i=199;i>=0;i--) if(cha[i]!=0) break;
		if(flag==1) for(;i>=0;i--) cout<<cha[i];
		else
		{
			cout<<'-';
			for(;i>=0;i--) cout<<0-cha[i];
		}
		cout<<endl;
	}
}
int main()
{
	int n;
	cin>>n;
	cin.get();
	for(int i=0;i<n;i++)
	{
		memset(a,'\0',sizeof(a));
		memset(b,'\0',sizeof(b));
		memset(beijianshu,0,sizeof(beijianshu));
		memset(jianshu,0,sizeof(jianshu));
		memset(cha,0,sizeof(cha));
		cin.getline(a,200);
		cin.getline(b,200);
		cin.get();
		len1=strlen(a);
		len2=strlen(b);
		reverse(a,b);
		flag=panduan();
		calculate();
		print();
	}
	return 0;
}


void minus(char a[],char b[],char result[]);
void main()
{
	int n,i;
	char a[max][1000]={0},b[max][1000]={0};
    char result[max][1000]={0};
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i],result[i]);
        printf("%s\n",result[i]);
	}
}

void minus(char a[],char b[],char result[])
{
	int la,lb,lresult;
    int flag=0;
    int t=0;
    int s,c=0;
    int i;
    char h[1000]={0};
    char temp1;
    la=strlen(a)-1;
    lb=strlen(b)-1;
    while(la >= 0)
	{
        if(lb < 0)
		{
			s=a[la--]-48;
		}
        else
		{
			s=a[la--]-b[lb--];
		}
        result[t++]=s-c+48;
        if(result[t-1] < 48)
		{
			result[t-1]+=10;
			c=1;
		}
        else c=0;
	}
	while(result[t] == 0) t--;
    while(result[t] == '0')
	{
		result[t]=0;t--;
	}
	lresult=t;
	for(i=0;i <= lresult/2;i++)
	{
        temp1=result[i];
        result[i]=result[lresult-i];
        result[lresult-i]=temp1;
    }
}


struct number
{
	char a[100];
	int lena;
	char b[100];
	int lenb;
}num[1000];

void main()
{
	int n,i,j,ll;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		   scanf("%s",num[i].a);
	       num[i].lena=strlen(num[i].a);
		   scanf("%s",num[i].b);
	       num[i].lenb=strlen(num[i].b);
	}
	for(i=0;i<n;i++)
	{
		ll=num[i].lena-num[i].lenb;
		for(j=num[i].lenb-1;j>=0;j--)
		{
			if(num[i].a[j+ll]-num[i].b[j]>=0)
				num[i].a[j+ll]=num[i].a[j+ll]-num[i].b[j]+48;
			else
			{
				num[i].a[j+ll]=num[i].a[j+ll]-num[i].b[j]+48+10;
				num[i].a[j+ll-1]--;
			}
		}
		printf("%s\n",num[i].a);
	}

}


void change(char ch[],int a[])
{
	int i;
	int nc;
	nc=strlen(ch);
	for(i=0;i<nc;i++)
	{
		a[i]=ch[i]-48;
	}
}

void minus(int a[],int b[],int na,int nb)
{
	int i;
	for(i=1;i<=nb;i++)
	{
		if(a[na-i]<b[nb-i])
		{
			a[na-i-1]--;
			a[na-i]=a[na-i]-b[nb-i]+10;
		}
		else
		{
			a[na-i]-=b[nb-i];
		}
	}
}

void print(int a[],int na)
{
	int i,j=0;
	for(j=0;a[j]==0;j++)
		i++;
	for(i=j;i<na;i++)
		printf("%d",a[i]);
}
int main()
{
	int a[100],b[100];
	char c[100];
	int n,i,j,na,nb;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",c);
		na=strlen(c);
		change(c,a);
		for(j=0;j<100;j++)
			c[j]='\0';
		scanf("%s",c);
		nb=strlen(c);
		change(c,b);
		minus(a,b,na,nb);
		print(a,na);
		printf("\n");
	}
	return 0;
}


void minus(char a[],char b[]);
void main()
{
	int n,i;
	char a[max][max],b[max][max];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i]);
        printf("%s\n",a[i]);
	}
}

void minus(char a[],char b[])
{
	int la,lb,i,t,j,s,c,k=0;
    la=strlen(a)-1;
    lb=strlen(b)-1;
	for(i=la-lb;i<=la;i++)
	{
		s=a[i];
		c=b[k];
		a[i]=s-c+48;
		t=i;
		while(a[i]<'0')
		{
			a[i]+=10;
			a[--i]--;
		}
		i=t;
		k++;
	}
	i=0;
	while(a[i]=='0')
	{
		for(j=0;j<=strlen(a);)
		{
			a[j]=a[++j];
		}
		i++;
	}
}


void main()
{
	int a,j,i;
	scanf("%d",&a);
	char **pp,**qq;
	int m,n;
	pp = (char **)malloc(a*sizeof(char*));
	qq = (char **)malloc(a*sizeof(char*));
	for(i=0;i<a;i++)
	{
		pp[i]=(char*)malloc(101*sizeof(char));
		qq[i]=(char*)malloc(101*sizeof(char));
		scanf("%s",pp[i]);
		scanf("%s",qq[i]);
	}
	for(i=0;i<a;i++)
	{
		m = strlen(pp[i]);
		n = strlen(qq[i]);
		for(j=m-1;j>=m-n;j--)
		{
			if(pp[i][j]<qq[i][n-m+j])
			{
				pp[i][j] = 10 + pp[i][j] - qq[i][n-m+j] + '0';
				pp[i][j-1]--;
			}
			else if(pp[i][j]>=qq[i][n-m+j])
				pp[i][j] = pp[i][j] - qq[i][n-m+j] + '0';
		}
		for(j=m-1;j>=0;j--)
			if(pp[i][j]<'0')
			{
				pp[i][j] += 10;
				pp[i][j-1] -= 1;
			}
		printf("%s\n",pp[i]);
	}
}


int main()
{
	char numa[201],  numb[201];
	int a[201], b[201], result[201];
	int n, i, j, k, la, lb;
	cin >> n;
	for (; n > 0; n--)
	{
		k = 0;
		cin.ignore();
		cin.getline(numa, 201);
		cin.getline(numb, 201);
		la = strlen(numa);
		lb = strlen(numb);
		memset(a, 0, sizeof(a));
		memset(b, 0, sizeof(b));
		memset(result, 0, sizeof(result));
		for(i = 0; i < la; i ++)
		{
			a[i] = numa[i] - '0';
		}
		for(j = 0; j < lb; j++)
		{
			b[j] = numb[j] - '0';
		}
		for(i = la - 1, j = lb - 1; i >= 0; i--, j--)
		{
			if(b[j] > a[i])
			{
				b[j - 1]++;
				result[i] = 10 + a[i] - b[j];
			}
			else
				result[i] = a[i] - b[j];
		}
		while (result[k] == 0)
			k++;
		for(i = k; i < la; i++)
			cout << result[i];
		cout << endl;
	}
	return 0;
}


int main ( )
{
	int n, i, j, k, len[100];
	char number[100][101], exp;
	cin >> n;
	cin.get();
	for (i = 0;i < 2*n;i++)
	{
		if (i == 2*n-1 || i % 2 == 0)
			cin.getline(number[i],101);
		else
		{
			cin.getline(number[i],101);
			cin.get();                 /*????*/
		}
	}
	for (i = 0;i < 2*n;i++)
	{
		for (j = 0,k = strlen(number[i])-1;j < k;j++,k--)/*??????????*/
		{
			exp = number[i][j];
			number[i][j] = number[i][k];
			number[i][k] = exp;
		}
		len[i] = strlen(number[i]);
	}
	for (i = 0;i < 2*n;i = i + 2)
	{
		for (j = 0;j < len[i + 1];j++)
		{
			if (number[i][j] < number[i + 1][j])
			{
				number[i][j] = number[i][j] + ':' - number[i + 1][j];
				number[i][j + 1] --;
			}
			else number[i][j] = number[i][j] - number[i + 1][j] + '0';
		}
		if (number[i][len[i]-1] == 0)
			number[i][len[i]-1] = '\0';
		len[i] = strlen(number[i]);
	}
	for (i = 0;i < 2*n;i = i + 2)     /*??????*/
	{
		for (j = len[i]-1;j >= 0;j--)
		{
			if (j == 0)
				cout << number[i][j] <<endl;
			else cout << number[i][j];
		}
	}
	return 0;
}


void MINUS(char* a,char* b);
void main()
{
	char jian[50][200],beijian[50][200];
	int n;
	int i=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",beijian[i]);
		scanf("%s",jian[i]);
	}
	for(i=0;i<n;i++)
	{
		MINUS(beijian[i],jian[i]);
	}
}

void MINUS(char* a,char* btemp)
{
	int lena,lenb;
	int i,j;
	char b[200];
	int temp=0;
	char tt='0';
	lena=strlen(a);
	lenb=strlen(btemp);
	for(i=0;i<lena-lenb;i++)//??
		b[i]='0';
	for(j=i+1;i<200;i++){
		b[i]=btemp[i-lena+lenb];
		}
	for(i=lena-1;i>=0;i--)
	{
		if(a[i]-b[i]+temp>=0){a[i]=a[i]-b[i]+temp+48;
		temp=0;}
		else{
			a[i]=a[i]-b[i]+temp+48+10;
			temp=-1;
		}
	}
for(i=0;i<200;i++)
{
	if(a[i]=='\0')break;
	if(a[i]!=tt){putchar(a[i]);
	tt='*';}

}
putchar('\n');
}


//   @ ?????.cpp
//   @ 1000012895
//   @ ???
//   @ 2010/11/17

int main()
{
	int n;
	cin >> n;
	char a[100], b[100];
	int inta[100], intb[100];
	int i, j, counta, countb, count0;
	for(i = 1; i <= n; i++)
	{
		cin >> a;
		cin >> b;
		for(counta = 0; a[counta] != '\0'; counta++)
			inta[counta] = a[counta] - '0';
		for(countb = 0; b[countb] != '\0'; countb++)
			intb[countb] = b[countb] - '0';
		for(j = counta - 1; j >= counta - countb; j--)
		{
			inta[j] = inta[j] - intb[j - counta + countb];
			if(inta[j] < 0)
			{
				inta[j] += 10;
				inta[j - 1]--;
			}
		}
		for(count0 = 0; inta[count0] == 0; count0++);
		for(j = count0; j < counta; j++)
			cout << inta[j];
		cout << endl;
		cin.get();
	}
	return 0;
}


char str1[N],str2[N],temp[N];

int max(int x,int y)
{
	return(x>y?x:y);
}

void major(char *str1,char *str2)
{
	int a[N],b[N];
	int len1,len2,len,t,jump,i;
	len1=strlen(str1);
        len2=strlen(str2);
        if(len1<len2)
	{
        strcpy(temp,str1);t=len1;
        strcpy(str1,str2);len1=len2;
        strcpy(str2,temp);len2=t;
	}
	len=max(len1,len2);
	jump=len-len2+1;
	for(i=len;i>=0;i--)
		str1[i]=str1[i-1];
	str1[0]='0';
	for(i=len;i>=jump;i--)
	{
		str2[i]=str2[i-jump];
	}
	for(i=0;i<jump;i++)
		str2[i]='0';
	for(i=len;i>=0;i--)
	{
		a[i]=str1[i]-'0';
		b[i]=str2[i]-'0';
	}
	for(i=len;i>=0;i--)
	{
		if(a[i]>=b[i])
			a[i]=a[i]-b[i];
		else
		{
			a[i]=a[i]+10-b[i];
			a[i-1]-=1;
		}
	}
	if(a[1]==0)
	{
		for(i=0;i<=len-2;i++)
			temp[i]=a[i+2]+'0';
		temp[len-1]='\0';
	}
	else if(a[1]!=0)
	{
		for(i=0;i<=len-1;i++)
			temp[i]=a[i+1]+'0';
		temp[len]='\0';
	}
	printf("%s\n",temp);
}
void main()
{
	char s1[100][N],s2[100][N];
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s1[i]);
		scanf("%s",s2[i]);
		if(i<n-1)
			printf("\n");
	}
	printf("\n");
	for(i=0;i<n;i++)
		major(*(s1+i),*(s2+i));
}


int main()
{
	char num1[200],num2[200];
	int result[200];
	int n,i,j,k,flag=0;
	int len1,len2;

	cin>>n;

	for (i=1;i<=n;i++)
	{
		cin.get();
		cin.getline (num1,200);
		cin.getline (num2,200);

		len1=strlen(num1);
		len2=strlen(num2);

		for (j=len1-1,k=len2-1;j>=0;j--,k--)
		{
			if (k>=0)
			{
				if (flag==1)
				{
					num1[j] -= 1;
					flag=0;
				}
				if (num1[j]<num2[k])
				{
					num1[j] += 10;
					flag=1;
				}
				result[j]=num1[j]-num2[k];
			}

			else
			{
				if (flag==1)
				{
					num1[j] -=1;
					flag=0;
				}
				result[j]=num1[j]-'0';
			}
		}

		for (j=0;j<len1;j++)
		{
			if (result[j]!=0)
				flag=1;
			if (result[j]==0 && flag==0)
				continue;
			else cout<<result[j];
		}
		cout<<endl;

		flag=0;
	}

	return 0;
}


void main()
{
	int n,lena,lens,i,j,k;
	char str[100],a[100],*pa,*ps,e[20],*p;
	scanf("%d",&n);
	gets(e);
	for(i=1;i<=n;i++)
	{
		gets(str);
		gets(a);
		gets(e);
		lens=strlen(str);
		lena=strlen(a);
		pa=a+lena-1;
		ps=str+lens-1;
		for(;pa>=a;pa--,ps--)
		{
			if(*ps>=*pa)
				*ps=*ps-*pa+48;
			else
			{
				*ps=*ps-*pa+58;
				p=ps-1;
				while(*p==0)
				{
					*p=57;
					p--;
				}
				*p=*p-1;
			}
		}
		for(k=0;k<=lens-1;k++)
		{
			if(str[i]!=0)
				break;
		}
		for(j=k;j<lens-1;j++)
			printf("%c",str[j]);
		printf("%c\n",str[lens-1]);
	}
}


int main ()
{
	char bjs[100],js[100];
	int n,l1,l2,i,j,cha,c;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
			scanf("%s",bjs);
			scanf("%s",js);
		l1=strlen(bjs);
		l2=strlen(js);
        cha=l1-l2;
        for(j=(l2-1);j>=0;j--)
		{
			if (bjs[j+cha]<js[j])
			{
				bjs[j+cha]=bjs[j+cha]+10-js[j]+'0';
                c=1;
				bjs[j+cha-1]=bjs[j+cha-1]-c;
			}
			else
				bjs[j+cha]=bjs[j+cha]-js[j]+'0';
		}
		for(j=0;j<l1;j++)
		printf("%c",bjs[j]);
		printf("\n");
		printf("\n");
	}
}


void minus(char a[],char b[],char result[]);
void main()
{
	int n,i;
	char a[max][max],b[max][max];
    char result[max][max];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i],result[i]);
        printf("%s\n",result[i]);
	}
}

void minus(char a[],char b[],char result[])
{
	int la,lb,t=0,s,c=0,i;
    char temp;
    la=strlen(a)-1;
    lb=strlen(b)-1;
    while(la >= 0)
	{
        if(lb < 0)
		{
			s=a[la--]-48;
		}
        else
		{
			s=a[la--]-b[lb--];
		}
        result[t++]=s-c+48;
        if(result[t-1] < 48)
		{
			result[t-1]+=10;
			c=1;
		}
        else c=0;
	}
	while(result[t] == 0) t--;
    while(result[t] == '0')
	{
		result[t]=0;t--;
	}
	for(i=0;i <= t/2;i++)
	{
        temp=result[i];
        result[i]=result[t-i];
        result[t-i]=temp;
    }
}


char a[200],b[200];
int alen;

void init();
void minus();
void output();

int main()
{
    int n,i;
    cin>>n;
    for (i=0;i<n;i++)
    {
        cin>>a>>b;
        init();
        minus();
        output();
    }
}

void init()
{
     int len1,len2,temp,i;
     alen=len1=strlen(a);
     for (i=0;i<(len1+1)/2;i++)
     {
         temp=a[i];
         a[i]=a[len1-i-1];
         a[len1-i-1]=temp;
     }
     for (i=0;i<len1;i++)
     {
         a[i]-='0';
     }
     len2=strlen(b);
     for (i=0;i<(len2+1)/2;i++)
     {
         temp=b[i];
         b[i]=b[len2-i-1];
         b[len2-i-1]=temp;
     }
     for (i=0;i<len2;i++)
     {
         b[i]-='0';
     }
     for (i=len2;i<len1;i++)
     {
         b[i]=0;
     }
}

void minus()
{
     int p,len,tp;
     p=0;
     while (p<alen)
     {
           if (a[p]>=b[p])
           {
                a[p]-=b[p];
           }
           else if (a[p]<b[p])
           {
                tp=p+1;
                while (a[tp]==0)
                {
                      a[tp]=9;
                      tp++;
                }
                a[tp]--;
                a[p]=a[p]+10-b[p];
           }
           p++;
     }
}

void output()
{
     int len,i,t;
     while (a[alen]==0)
     {
           if (alen==0)
           {
              cout<<0<<endl;
              return;
           }
           alen--;
     }
     for (i=alen;i>=0;i--)
     {
         t=a[i];
         cout<<t;
     }
     cout<<endl;
}


int maxi(int a,int b)
{
	if(a>b) return a;
	else return b;
}
int main()
{
   int n,i;
   char a[102],b[102];
   int na[102],nb[102],sum[200];
   cin>>n;
   for(i=0;i<n;i++)
   {   int j,k=0;
		memset(a,'\0',sizeof(a));
		memset(b,'\0',sizeof(b));
		memset(na,0,sizeof(na) );
		memset(nb,0,sizeof(na) );
		memset(sum,0,sizeof(sum) );
	   cin>>a>>b;
	   int lena=strlen(a),lenb=strlen(b);
	   for(j=lena-1;j>=0;j--)
		   na[k++]=a[j]-'0';
	   k=0;
	   for(j=lenb-1;j>=0;j--)
		  nb[k++]=b[j]-'0';
	   int MaxLen=maxi(lena,lenb);
	   for(j=0;j<MaxLen;j++)
	   {
		   sum[j]+=na[j]-nb[j];
		   if(sum[j]<0)
			 {  sum[j]+=10;
		        sum[j+1]--;
		   }
	   }
	   int flag=0;
	   for(j=MaxLen-1;j>=0;j--)
	   {
		   if(sum[j]==0&&flag==0)
						;
		   if(sum[j]!=0&&flag==0)
		   {
			   flag=1;
			   cout<<sum[j];
		   }
		   else if(flag==1)
		   cout<<sum[j];
	   }
	   cout<<endl;
   }
   return 0;

}


int main()
{
	int str_1[100],str_2[100],str_3[100],n,k;
	char str_a[101],str_b[101];
	int len_a,len_b;
	cin>>n;
	for(k=0;k<n;k++)
	{
	cin.get();
	cin.getline(str_a,101);
	cin.getline(str_b,101);
	len_a=strlen(str_a);
	len_b=strlen(str_b);
	memset(str_1,0,sizeof(str_1));
	memset(str_2,0,sizeof(str_2));
	memset(str_3,0,sizeof(str_3));
	int i,j=0;
	for(i=len_a-1;i>=0;i--)
		str_1[j++]=str_a[i]-'0';
	j=0;
	for(i=len_b-1;i>=0;i--)
		str_2[j++]=str_b[i]-'0';
	for(i=0;i<len_b;i++)
	{
		if(str_1[i]>=str_2[i])
			str_3[i]=str_1[i]-str_2[i];
		else
		{
		    str_3[i]=str_1[i]-str_2[i]+10;
			str_1[i+1]--;
		}
	}
	for(;i<len_a;i++)
		str_3[i]=str_1[i];
	for(i=99;i>=0;i--)
	{
		if(str_3[i]!=0)
			break;
	}
	if(i==-1)
		cout<<0;
	else
		for(;i>=0;i--)
			cout<<str_3[i];
	cout<<endl;
	}
	return 0;
}

/*
int main()
{
	const int MAX_LEN = 250;
	unsigned an1[MAX_LEN];
	unsigned an2[MAX_LEN];
	char seLine1[MAX_LEN + 1];
	char seLine2[MAX_LEN + 1];
	cin.getline(seLine1, MAX_LEN + 1);
	cin.getline(seLine2, MAX_LEN + 1);
	int nLen1 = strlen(seLine1);
	int nLen2 = strlen(seLine2);
	memset(an1, 0, sizeof(an1));
	memset(an2, 0,sizeof(an2));
	int i, j=0;
	for (i = nLen1-1;  i>=0; i--)
		an1[j++] = seLine1[i] - '0'; //???????????????
	j=0;
	for (i = nLen2-1; i>=0;i--)
		an2[j++] = seLine2[i] - '0';
	for (i = 0; i < MAX_LEN ;i++)
	{
		an1[i] += an2[i];
		if(an1[i] >= 10) //??????
		{
			an1[i] -=10;
			an1[i + 1]++; // i++?
		}
	}
	i = MAX_LEN - 1;
	for(;i>=0;i--)
		if(an1[i]!=0)
			break; //???????0??
	if(i==-1)
		cout<<0<<endl;
	else
	{
		for(;i >= 0; i--)
			cout << an1[i]; //??????
		cout << endl;
	}
	return 0;
}*/


/* Note:Your choice is C IDE */
main()
{
	void minus(char a[999],char b[999]);
	char a[999],b[999];
	int n,i,z;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s%s",a,b);
		minus(a,b);
	}
}
void minus(char a[999],char b[999])
{
	int x,y,w;
	x=strlen(a);
	y=strlen(b);
	for(w=x-1;w>=x-y;w--)
	{
		    if(a[w]>=b[w-x+y])
		    {
		    	a[w]=a[w]-b[w-x+y];
		    }
		    else
		    {
			    a[w-1]--;
			    a[w]=a[w]+10-b[w-x+y];
		    }

	}
    for(w=0;w<=x-1;w++)
    {
    	if(a[w]==0) continue;
    	else break;
    }
    for(w=w;w<=x-y-1;w++)
    printf("%c",a[w]);
    for(w=x-y;w<=x-1;w++)
    printf("%d",a[w]);
    printf("\n");
}


char a[100],b[100];int c[100];

int main()
{
    //freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    int n;
    cin>>n;
    while(n--)
    {
              cin>>a>>b;
              int lena=strlen(a);
              int lenb=strlen(b);
              for(int i=0;i<lena/2;i++)
               {
                      char t=a[i];
                      a[i]=a[lena-1-i];
                      a[lena-1-i]=t;
               }
               for(int i=0;i<lenb/2;i++)
               {
                      char t=b[i];
                      b[i]=b[lenb-1-i];
                      b[lenb-1-i]=t;
               }
               for(int i=0;i<lenb;i++)
               c[i]=a[i]-b[i];
               for(int i=lenb;i<lena;i++)
               c[i]=a[i]-'0';
               for(int i=0;i<lena-1;i++)
                 if(c[i]<0) {
                              c[i]=10+c[i];
                              c[i+1]-=1;
                            }
               for(int i=lena-1;i>=0;i--)
               {
                       if(c[i]!=0)
                       {
                                  for(int j=i;j>=0;j--)
                                  cout<<c[j];
                                  cout<<endl;
                                  break;
                       }
               }
    }
    return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		char a[101]={'0'},b[101]={'0'};
		scanf("%s\n%s",a,b);
		int lena,lenb;
		lena=strlen(a);
		lenb=strlen(b);
		int na[101]={0},nb[101]={0},nc[101]={0};
		int curr;
		for(curr=0;curr<lena;curr++){
			na[curr]=a[lena-1-curr]-'0';
		}
		for(curr=0;curr<lenb;curr++){
			nb[curr]=b[lenb-1-curr]-'0';
		}
		int r=0;
		for(curr=0;curr<lena;curr++){
			if(na[curr]-r>=nb[curr]){
				nc[curr]=na[curr]-r-nb[curr];
				r=0;
			}
			else{
				nc[curr]=na[curr]-r+10-nb[curr];
				r=1;
			}
		}
		printf("\n");
		if(nc[lena-1]!=0)printf("%d",nc[lena-1]);
		for(curr=lena-2;curr>=0;curr--)printf("%d",nc[curr]);
	}
	return 0;
}


char *minus(char *a,char *b)
{
	char *c;
	int m,n;
	int i=0,j=0,k=0;
	m=strlen(a);
	n=strlen(b);
	c=(char *)malloc(sizeof(char)*N);
	k=N-1;
	c[k]=0;
	k--;
	i=m-1;
	for(j=n-1;j>=0;j--){
		if(a[i]>=b[j]){
			c[k]=a[i]-b[j]+'0';
		}
		else{
			c[k]=a[i]-b[j]+10+'0';
			a[i-1]=a[i-1]-1;
		}
		k--;
		i--;
	}
	while(i>=0){
		c[k]=a[i];
		k--;
		i--;
	}
	return c+k+1;

}

void main()
{
	char **s1,**s2,**s3;
	int n=0,i=0;
	scanf("%d",&n);
	s1=(char **)malloc(sizeof(char *)*n);
	s2=(char **)malloc(sizeof(char *)*n);
	s3=(char **)malloc(sizeof(char *)*n);
	while(i<n){
		s1[i]=(char *)malloc(sizeof(char)*N);
		s2[i]=(char *)malloc(sizeof(char)*N);
		scanf("%s",s1[i]);
		scanf("%s",s2[i]);
		printf("\n");
		s3[i]=minus(s1[i],s2[i]);
		i++;
	}
	for(i=0;i<n;i++){
		puts(s3[i]);
	}

}


int main()
{
	char str1[102], str2[102];
	int result[102];
	int n,i,j,k;
	scanf("%d", &n);
	for(i = 0; i < n; i++)
         {
		scanf("%s%s", str1, str2);
		int borrow = 0;
		int len1 = strlen(str1);
		int len2 = strlen(str2);
		int len;
		len = len1;
		for(j=len2-1; j>=0;j--)
                  {
			str2[j + len1 - len2] = str2[j];
		}
		for(j=0;j<len1-len2;j++)
                  {
			str2[j] = '0';
		}
		for(k = len - 1; k >= 0; k--)
                  {
			int temp = (str1[k] - '0') - (str2[k] - '0') - borrow;
			if(temp < 0)
                           {
				borrow = 1;
				result[k] = temp + 10;
			}
                           else
                           {
				borrow = 0;
				result[k] = temp;
			}
		}
		int k;
		for(k=0; result[k] == 0; k++);
		for(k=0;k<len; k++)
                  {
			printf("%d", result[k]);
		}
		printf("\n");
	}
	return 0;
}


void main()
{
	int times,i,j,lena,lenb;
	char a[1000],b[1000],c[2];
	scanf("%d\n",&times);
	for(j = 0;j<times;j++)
	{
		gets(a);
		gets(b);
		gets(c);
		lena = strlen(a);
		lenb = strlen(b);
		for(i = 1;i<=lenb;i++)
			a[lena-i] -= b[lenb-i]-48;
		for(i = lena-1;i>0;i--)
		{
			if(a[i]<'0')
			{
				a[i] += 10;
				a[i-1]--;
			}
		}
		printf("%s\n",a);
	}
}


/*
 * ????BigIntegerSubtraction.cpp
 * ?????????????
 * Created on: 2010-12-25
 * Author: ???
 */
int main()
{
	int n;
	char a[100],b[100];
	char d[100],e[100];
	int f[100];
	int i,j,k;
	int p,q;
	memset(a,0,sizeof(a));
	memset(b,0,sizeof(b));
	memset(f,0,sizeof(f));
	memset(d,0,sizeof(d));
	memset(e,0,sizeof(e));
	cin>>n;
	gets(a);
	for(k=1;k<=n;k++)
	{
		memset(a,0,sizeof(a));
			memset(b,0,sizeof(b));
			memset(f,0,sizeof(f));
			memset(d,0,sizeof(d));
			memset(e,0,sizeof(e));
		cin>>a;
		cin>>b;
		p=strlen(a);
		q=strlen(b);
		for(j=0;j<p;j++)
			d[j]=a[p-1-j];
		for(j=0;j<q;j++)
			e[j]=b[q-1-j];
		for(i=0;i<q;i++)
		{
			if(d[i]>=e[i])
               f[i]=d[i]-e[i];
			else
			{
				f[i]=10+d[i]-e[i];
				d[i+1]=d[i+1]-1;
			}

		}
		for(;i<p;i++)
			f[i]=d[i]-'0';
		for(i=99;i>=0;i--)
		{
			if(f[i]!=0)
				break;

		}
		for(;i>=0;i--)
			cout<<f[i];
        cout<<endl;

	}
	return 0;

}


void calc()
{ 	const int MAX_LEN = 200;
	int an1[MAX_LEN]; int an2[MAX_LEN];
	char seLine1[MAX_LEN + 1]; char seLine2[MAX_LEN + 1];
	//cout << "please input two integers" << endl;
	cin >> seLine1;
	cin >> seLine2;
	int nLen1 = strlen(seLine1);
	int nLen2 = strlen(seLine2);
	memset(an1, 0, sizeof(an1));
	memset(an2, 0, sizeof(an2));
	int i, j=0;
	for (i = nLen1-1;  i>=0; i--)
		an1[j++] = seLine1[i] - '0';
	j=0;
	for (i = nLen2-1; i>=0;i--)
		an2[j++] = seLine2[i] - '0';
	for (i = 0; i < nLen1 ;i++)
	{
	    //printf("%d\n", an1[i]);
		an1[i] -= an2[i];
		if(an1[i] < 0)
		{
			an1[i] +=10;
			an1[i + 1]--;
		}
	}
	i = nLen1 - 1;
	while(i > 0 && an1[i]==0) i--;
	//printf("%d\n", i);
	for(;i >= 0; i--)
		cout << an1[i];
	cout << endl;
}

int main()
{
    int n;
    cin >> n;
    while (n --)
        calc();
}


int main()
{
	int n;
	char a[108];
	char b[108];
	char c[108];
	int i, j, k;
	int la, lb;
	int bit;

	cin >> n;

	for(k = 0; k < n; k ++)
	{
		cin >> a >> b;

		bit = 0;

		la = strlen(a);
		lb = strlen(b);

		for(i = la - 1; i >= la - lb; i --)
		{
			if(a[i] - b[i - la + lb] - bit >= 0)
			{
				c[i] = a[i] - b[i - la + lb] - bit + '0';
				bit = 0;
			}
			else
			{
				c[i] = a[i] - b[i - la + lb] - bit + 10 + '0';
				bit = 1;
			}
		}

		c[la - lb - 1] = a[la - lb - 1] - bit;

		for(i = 0; i < la - lb - 1; i ++)
			c[i] = a[i];

		c[la] = '\0';

		cout << c << endl;

	}

	return 0;
}


int main()
{
	int  i, j, n, k, lena, lenb, pos;

	char a[101], b[101];
	cin >> n;
	for(k = 1; k <= n; k++)
	{
		cin.get();
		if(i >= 2)
			cout << endl;
		cin.getline(a, 101);
		cin.getline(b, 101);
		lena = strlen(a);
		lenb = strlen(b);
		int numa[100]={0};
		int numb[100]={0};
		j = 0;
		for(i = lena - 1; i >= 0; i--)
			numa[j++] = a[i] - '0';
		j = 0;
		for(i = lenb - 1; i >= 0; i--)
			numb[j++] = b[i] - '0';
		for(i = 0; i < lena; i++)
		{
			numa[i] = numa[i] - numb[i];
			if(numa[i] < 0)
			{
				numa[i] += 10;
				numa[i + 1]--;
			}
		}
		i = lena - 1;
		while(numa[i] != 0)
		{
			pos = i;
			break;
		}
		for(i = pos; i >= 0; i--)
			cout << numa[i];
		cout << endl;
	}
	return 0;
}


int maxlen(int x, int y);
int main()
{
    int N;
        char s1[201], s2[201];
    int a[201], b[201], maxx, l1, l2,i,j;
    N = maxx = l1 = l2 = 0;
    scanf("%d", &N);
    for (int n = 0; n < N; n++) {
        memset(s1, 0, sizeof(s1));
        memset(s2, 0, sizeof(s2));
        memset(a, 0, sizeof(a));
        memset(b, 0, sizeof(b));
        scanf("%s", s1);
        scanf("%s", s2);
        l1 = strlen(s1);
        l2 = strlen(s2);
        maxx = maxlen(l1, l2);
        for ( i = maxx, j = l1 - 1; j>=0; i--, j--)
            a[i] = s1[j] - '0';
        for ( i = maxx, j = l2 - 1; j>=0; i--, j--)
            b[i] = s2[j] - '0';
        for ( i = maxx; i > 0; i--)
        {

            if (a[i] <b[i])
            {
                a[i] =a[i]+ 10-b[i];
                a[i-1] --;
            }
			else a[i] -= b[i];
        }
        i = 0;
        while (a[i] == 0)
            i ++;
        for (; i<maxx + 1; i++)
            printf("%d", a[i]);
            printf("\n");
    }

    return 0;
}
int maxlen(int x, int y){
    if (x > y)
       return x;
    return y;
}


int str2bigint(char*str,int*a)
{
	int len=(int)strlen(str);
	int i;
	for(i=0;i<len;i++)
	{
		a[len-i-1]=str[i]-'0';
	}
	return len;
}

void print_bigint(int*a,int len)
{
	int k=len-1;
	int i;
	while(a[k]==0&&k>0)
	{
		k--;
	}
	for(i=k;i>=0;i--)
	{
		printf("%d",a[i]);
	}
}

int sub_bigint(int*a,int alen,int*b,int blen,int*c)
{
	int i;
	for(i=0;i<alen;i++)
	{
		c[i]=a[i];
		if(i<blen) c[i]-=b[i];
	}

	for(i=0;i<alen;i++)
	{
		if(c[i]<0)
		{
			c[i+1]--;
			c[i]+=10;
		}
	}
	return c[alen-1]?alen:(alen-1);
}

int main(int argc, char* argv[])
{
	char s1[MAX],s2[MAX];
	int a[MAX],b[MAX],c[MAX];
	int alen,blen,clen;
	int i,n;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",s1,s2);
		alen=str2bigint(s1,a);
		blen=str2bigint(s2,b);
		clen=sub_bigint(a,alen,b,blen,c);
		print_bigint(c,clen);
		printf("\n");
	}
	return 0;
}


void minus(char a[],char b[],char result[]);
void main()
{
	int n,i;
	char a[max][max],b[max][max];
    char result[max][max];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s\n%s\n\n",a[i],b[i]);
		minus(a[i],b[i],result[i]);
        printf("%s\n",result[i]);
	}
}

void minus(char a[],char b[],char result[])
{
	int la,lb,lresult;
    int flag=0;
    int t=0;
    int s,c=0;
    int i;
    char temp1;
    la=strlen(a)-1;
    lb=strlen(b)-1;
    while(la >= 0)
	{
        if(lb < 0)
		{
			s=a[la--]-48;
		}
        else
		{
			s=a[la--]-b[lb--];
		}
        result[t++]=s-c+48;
        if(result[t-1] < 48)
		{
			result[t-1]+=10;
			c=1;
		}
        else c=0;
	}
	while(result[t] == 0) t--;
    while(result[t] == '0')
	{
		result[t]=0;t--;
	}
	lresult=t;
	for(i=0;i <= lresult/2;i++)
	{
        temp1=result[i];
        result[i]=result[lresult-i];
        result[lresult-i]=temp1;
    }
}


void main()
{
	char str1[100],str2[100];int n,i,j,k,p;
	int a[100],b[100];
	int yidegeshu,erdegeshu;
	scanf("%d",&n);
	for(p=0;p<=n-1;p++)
	{
		scanf("%s",str1);
		scanf("%s",str2);
		yidegeshu=strlen(str1);
		erdegeshu=strlen(str2);
		for(i=0;i<=yidegeshu-1;i++)
			a[i]=str1[yidegeshu-i-1]-48;
		for(i=0;i<=erdegeshu-1;i++)
			b[i]=str2[erdegeshu-i-1]-48;
		for(j=erdegeshu;j<=yidegeshu-1;j++)
			b[j]=0;
	for(i=0;i<=yidegeshu-1;i++)
	{
		if(a[i]>=b[i])
		{a[i]=a[i]-b[i];}
		else if(a[i]<b[i])
		{
			a[i]=a[i]+10;
		    a[i+1]=a[i+1]-1;
			a[i]=a[i]-b[i];
		}
	}
	for(k=yidegeshu-1;k>=0;k--)
	{	printf("%d",a[k]);}
	printf("\n");
	}
}


int main()
{
    int n;
    int i,j;
    char a[101];
    char b[101];
    int a1[101];
    int b1[101]={0};
    int c[101]={0};
    scanf("%d",&n);
    int length1,length2,length;
    for(j=1;j<=n;j++)
    {
       for(i=0;i<=100;i++)
       {
           a1[i]=b1[i]=c[i]=0;
       }
        scanf("%s%s",a,b);
         length1=strlen(a);
         length2=strlen(b);
        if(length1>length2)
         {length=length1;}
         else
         {length=length2;}
         for(i=0;i<length1;i++)
         {
             a1[i]=a[length1-i-1]-'0';
         }
         for(i=0;i<length2;i++)
         {
             b1[i]=b[length2-i-1]-'0';
         }
          for(i=0;i<length;i++)
         {
             c[i]+=a1[i]-b1[i];
             while(c[i]<0)
             {
                 c[i]=c[i]+10;
                 c[i+1]--;
             }
        }
         for(i=0;i<length;i++)
         {
             printf("%d",c[length-i-1]);
         }
         printf("\n");
    }
    return 0;
}


int main ()
{
	int n , i , j , k,num1[101]={0},num2[101]={0},res[101]={0} ;
	cin >> n ;
	cin.get();
	char str1[101] , str2[101] ;
	for (i = 0 ;i < n ;i++)
	{
		memset(num1 , 0 , sizeof(num1)) ;
		memset(num2 , 0 , sizeof(num2)) ;
		memset(res , 0 , sizeof(res)) ;
		cin.getline(str1,101) ;
		cin.getline(str2,101) ;
		cin.get() ;
		for (j = 0 ; j < strlen(str2) ; j++ )
			num2[j] = str2[strlen(str2)-j-1]-'0' ;
		for (j = 0 ; j < strlen(str1) ; j++ )
			num1[j] = str1[strlen(str1)-j-1]-'0' ;
		for(k = 0 ; k < strlen(str1) ; k++)
		{
			if(num1[k]-num2[k]<0)
			{
				res[k]=num1[k]-num2[k]+10;
				num1[k+1]-- ;
			}
			else res[k]=num1[k]-num2[k] ;
		}
		for(k = strlen(str1)-1  ; k >= 0 ; k--)
		{
			if(res[k]==0)
				continue ;
			break ;
		}
		while (k >=0 )
		{
			cout << res[k];
			k-- ;
		}
		cout << endl;
	}
	return 0 ;
}


char szline1[maxlen];
char szline2[maxlen];
int an1[maxlen];
int an2[maxlen];
int main()
{
	int n;
	cin >> n;
	while (n --)
	{
		cin.get();
		cin.getline(szline1, maxlen);
		cin.getline(szline2, maxlen);
		int len1 = strlen(szline1);
		int len2 = strlen(szline2);
		memset(an1, 0, sizeof(an1));
		memset(an2, 0, sizeof(an2));
		for (int i = len1 - 1, j = 0; i >= 0; i --)
			an1[j ++] = szline1[i] - '0';
		for (int i = len2 - 1, j = 0; i >= 0; i --)
			an2[j ++] = szline2[i] - '0';
		int begin = 0;
		for (int i = 0; i < maxlen; i ++)
		{
			an1[i] -= an2[i];
			if (an1[i] < 0)
			{
				an1[i] += 10;
				an1[i + 1] --;
			}
			if (an1[i])
				begin = i;
		}
		for (int i = begin; i >= 0; i --)
			cout << an1[i];
		cout << endl;
	}
	return 0;
}


void minus(char *a,char *b,int na,int nb,char *c)
{
	int i;
	for(i=0;i<nb;i++)
   {
	   if((a[i]-b[i])<0)
       {
		   c[i]=10+a[i]-b[i]+'0';
	       a[i+1]--;
	   }
	   else
		   c[i]=a[i]-b[i]+'0';

	}
   for(i=nb;i<na-1;i++)
   {
	   if(a[i]<'0')
	   {
		   a[i]=a[i]+10;
		   a[i+1]--;
	   }
	   c[i]=a[i];
   }
   c[na-1]=a[na-1];
   }
void exchange(char *a,int na)
{
 int k;
 for(k=1;k<=(na/2);k++)
		{
			int t;
			t=a[k-1];
			a[k-1]=a[na-k];
			a[na-k]=t;
		}
}
void main()
{
    int n,i,k,j;
	scanf("%d",&n);
	char **c;
	c=(char**)malloc((n+1)*sizeof(char *));
	if(c!=NULL)
    {char a[100]
,b[100];
	int na,nb;
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		scanf("%s",b);
		na=strlen(a);
		nb=strlen(b);
	    exchange(a,na);
		exchange(b,nb);
		c[i]=(char*)malloc((na+1)*sizeof(char));
		if(c[i]!=NULL)
		minus(a,b,na,nb,c[i]);
	}
	for(i=0;i<n;i++)
	{
		for(k=strlen(c[i])-1;k>0;k--)
	   {
		 if(c[i][k]>'0')
			 break;
		}
		for(j=k;j>=0;j--)
		{
			printf("%c",c[i][j]);
			if(j==0)
				printf("\n");
		}
		free(c[i]);
	}
	free(c);
	}
}


int main()
{
  int n;
  cin>>n;
  int i,j,k;
  char c[n][101];
  int d[n];
  for(j=0;j<n;j++)
  {
     char a[101],b[101];
     cin>>a>>b;
     if(j==n-1);
     else cin.get();
     int sizea,sizeb;
     sizea=strlen(a);
     d[j]=sizea;
     sizeb=strlen(b);
     for(i=sizeb-1;i>=0;i--)
     {
         b[i+sizea-sizeb]=b[i];
     }
     for(i=0;i<sizea-sizeb;i++)
     b[i]='0';
     for(i=sizea-1;i>=0;i--)
     {
        if(a[i]>=b[i])
        c[j][i]=a[i]-b[i]+'0';
        else if(a[i]<b[i])
        {
            a[i-1]=a[i-1]-1;
            a[i]=a[i]+10;
            c[j][i]=a[i]-b[i]+'0';
        }
     }

  }
  for(i=0;i<n;i++)
  {
     for(j=0;j<n;j++)
     if(c[i][j]!='0')
     break;
     for(k=j;k<d[i];k++)
     cout<<c[i][k];
     cout<<endl;
  }

  return 0;
}


const int base=250;
const int start=5;
int ans[300];
main()
{
void trans(char s[],int num[]);
void plus(int a[],int b[]);
int minus(int a[],int b[]);
void print(int num[]);
int judge(int a[],int b[]);

int a[300],b[300];
char sa[300],sb[300];
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++)
{
getchar();
gets(sa);
gets(sb);
memset(a,0,300*sizeof(int));
memset(b,0,300*sizeof(int));
memset(ans,0,300*sizeof(int));
trans(sa,a);
trans(sb,b);
b[0]=0-b[0];
if (a[0]*b[0]>0)
{
plus(a,b);
ans[0]=a[0];
}
else
{
int flag=judge(a,b);
if (flag==0) {printf("0\n"); continue;}
if (flag>0)
{minus(a,b);ans[0]=a[0];}
else {minus(b,a);ans[0]=b[0];}
}
print(ans);
}
getchar();getchar();getchar();getchar();
}

void trans(char s[],int num[])
{
int len=strlen(s),b=0;
num[0]=1;
if (s[0]=='-') {len--; b++; num[0]=-1;}
for (int t=0;t<len;t++)
{
num[base-len+t+1]=s[t+b]-'0';
}
num[1]=base-len+1;
}

int judge(int a[],int b[])
{
if (a[1]<b[1]) return 1;
else if (a[1]>b[1]) return -1;
else {
     int t,p=0,floor=a[1]<b[1]?a[1]:b[1];
     for (t=floor;t<=base&&p==0;t++)
     p=a[t]-b[t];
     if (p==0) return 0;
     else return p>0?1:-1;
     }
}

void check(int num[])
{
int p;
for (p=start;num[p]==0&&p<=base;p++);
num[1]=p;
}

void plus(int a[],int b[])
{
int floor=a[1]<b[1]?a[1]:b[1];
for (int t=base;t>=floor;t--)
{
int k=ans[t]+a[t]+b[t];
ans[t]=k%10;
ans[t-1]+=k/10;
}
if (ans[floor-1]!=0) ans[1]=floor-1;
else ans[1]=floor;
}

void minus(int a[],int b[])
{
int floor=a[1]<b[1]?a[1]:b[1];
for (int t=base;t>=floor;t--)
{
int k=ans[t]+a[t]-b[t];
if (k<0) {ans[t-1]-=1; k+=10;}
ans[t]=k%10;
ans[t-1]+=k/10;
}
check(ans);
}

void print(int num[])
{
if (num[0]<0) printf("-");
for (int t=num[1];t<=base;t++)
printf("%d",num[t]);
printf("\n");
}


int main(){
       char a[20][100],b[20][100];
       char c[20][100];
       int i,len1,len2,d,n,cycle;
       scanf("%d\n",&n);
       for(cycle=0;cycle<n;cycle++)
       {
         gets(a[cycle]);
         gets(b[cycle]);
         scanf("\n");
         len1=strlen(a[cycle]);
         len2=strlen(b[cycle]);
         d=len1-len2;

       for(i=len1-1;i>=0;i--){
           if(i>=d){
           c[cycle][i]=a[cycle][i]-b[cycle][i-d]+48;
           if(a[cycle][i]<b[cycle][i-d]){
               a[cycle][i-1]=a[cycle][i-1]-1;
               c[cycle][i]+=10;}
           }else c[cycle][i]=a[cycle][i];
         }
       len2=0;d=0;i=0;len1=0;
       }
       int j;
       for(j=0;j<n;j++){

           printf("%s\n",c[j]);
       }

}


int main()
{
    int n, i, len1, len2, j, k, char11[101] = {0}, char22[101] = {0}, flag = 0, answer[101] = {0};
    char char1[101], char2[101];
    cin >> n;
    for (i = 1; i <= n; i++)
    {
        cin >> char1 >> char2;
        len1 = strlen(char1);
        len2 = strlen(char2);
        memset(answer,'\0',sizeof(answer));
        memset(char11,'\0',sizeof(char11));
        memset(char22,'\0',sizeof(char22));
        k = 0;
        for (j = len1 - 1; j >= 0; j--)
        {
            char11[k] = char1[j] - '0';
            k++;
        }
        k = 0;
        for (j = len2 - 1; j >= 0; j--)
        {
            char22[k] = char2[j] - '0';
            k++;
        }
        for (j = 0; j < len1; j++)
        {
            if (char11[j] < char22[j])
            {
                char11[j + 1] = char11[j + 1] - 1;
                answer[j] = char11[j] + 10 - char22[j];
            }
            else
            {
                answer[j] = char11[j] - char22[j];
            }
        }
        for (j = len1 - 1; j >= 0; j--)
        {
            if (answer[j] != 0)
            {
                flag = 1;
            }
            if (flag == 1)
            {
                cout << answer[j];
            }
        }
        cout << endl;
    }
    return 0;
}


int main()
{
	int n, len_a, len_b;
	char a[101], b[101];
	int num[101];
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin.get();
		cin.getline(a, 101);
		len_a = strlen(a);
		cin.getline(b, 101);
		len_b = strlen(b);
		memset(num, 0, sizeof(num));
		for(int i = len_a - 1; i >= 0; i--)
			num[len_a - i] = a[i] - '0';
		for(int i = len_b - 1; i >= 0; i--)
		{
			int j = len_b - i, b0 = b[i] - '0';
			if(num[j] >= b0)
				num[j] -= b0;
			else
			{
				num[j + 1]--;
				num[j] = num[j] + 10 - b0;
			}
		}
		int i = 100;
		while(num[i] == 0 && i != 1)
				i--;
		for(int j = i; j >= 1; j--)
			cout << num[j];
		cout << endl;
	}
	return 0;
}


int bigint1(char*str,int*a)
{
	int len=(int)strlen(str);
	int i;
	for(i=0;i<len;i++)
		a[len-i-1]=str[i]-'0';
	return len;
}

void bigint2(int*a,int len)
{
	int k=len-1;
	int i;
	while(a[k]==0&&k>0)
		k--;
	for(i=k;i>=0;i--)
		printf("%d",a[i]);
}

int bigint3(int*a,int alen,int*b,int blen,int*c)
{
	int i;
	for(i=0;i<alen;i++)
	{
		c[i]=a[i];
		if(i<blen) c[i]-=b[i];
	}
	for(i=0;i<alen;i++)
	{
		if(c[i]<0)
		{
			c[i+1]--;
			c[i]+=10;
		}
	}
	return c[alen-1]?alen:(alen-1);
}

int main(int argc, char* argv[])
{
	char s1[300],s2[300];
	int a[300],b[300],c[300];
	int alen,blen,clen;
	int i,n;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s%s",s1,s2);
		alen=bigint1(s1,a);
		blen=bigint1(s2,b);
		clen=bigint3(a,alen,b,blen,c);
		bigint2(c,clen);
		printf("\n");
	}
	return 0;
}


int leap(int *p,int n)
{
    if(n==0) return -1;
    if((*p)!=0) return 0;
    else return leap(p+1,n-1)+1;
}
int main()
{
    int n,i;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
                    char a[100],b[100];
                    int j,k=0,f=0,c[100]={0};
                    scanf("%s %s",a,b);
                    int len1=strlen(a),len2=strlen(b);
                    if(len1<len2) f=-1;
                    else if(len1==len2)
                         for(j=0;j<len1;j++)
                              if(a[j]<b[j])
                              {
                                           f=-1;
                                           break;
                              }
                    if(f==-1)
                    {
                             printf("-");
                             char s[100];
                             strcpy(s,a);
                             strcpy(a,b);
                             strcpy(b,s);
                             int len=len1;
                             len1=len2;
                             len2=len;
                    }
                    for(j=len2-1;j>=0;j--)
                                          b[j+len1-len2]=b[j];
                    for(j=len1-len2-1;j>=0;j--)
                                               b[j]='0';
                    for(j=len1-1;j>=0;j--)
                    {
                                          c[j]=a[j]-b[j]-k;
                                          if(c[j]<0)
                                          {
                                                    c[j]+=10;
                                                    k=1;
                                          }
                                          else k=0;
                    }
                    j=leap(c,len1);
                    if(j==-1) printf("0");
                    else
                        for( ;j<len1;j++)
                                         printf("%d",c[j]);
                    printf("\n");
    }
    return 0;
}


void calculate(int);
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
		calculate(n-i==1?0:1);
	return 0;
}
void calculate(int isblank)
{
	char large[101],small[101],dif[101];
	int large_len,small_len,digit_L,digit_S,digit_dif;
	char *p_L,*p_S,*p_dif;
	scanf("%s",large);
	scanf("%s",small);
	large_len=strlen(large);
	p_L=large+large_len-1;
	small_len=strlen(small);
	p_S=small+small_len-1;
	p_dif=dif+large_len-1;
	*(p_dif+1)=0;
	while(p_S-small+1)
	{
		digit_L=*p_L-'0';
		digit_S=*p_S-'0';
		digit_dif=digit_L-digit_S;
		if(digit_dif<0)
		{
			digit_dif+=10;
			(*(p_L-1))--;
		}
		*p_dif=digit_dif+'0';
		p_L--;
		p_S--;
		p_dif--;
	}
	while(p_L>=large)
	{
		*p_dif=*p_L;
		if(*p_L<'0')
		{
			*p_dif+=10;
			(*(p_L-1))--;
		}
		p_L--;
		p_dif--;
	}
	do
		p_dif++;
	while(*p_dif=='0');
	if(*p_dif)
		puts(p_dif);
	else
		printf("0\n");
	if(isblank)
		gets(dif);
}


int s1[MAX];
int s2[MAX];
char num1[MAX];
char num2[MAX];
int Minus(int maxx, int * s1, int *s2)
{
	int i;
	int largest = 0;
	for(i=0;i<maxx;i++)
	{
		s1[i]-=s2[i];
		if(s1[i]<0)
		{s1[i] += 10;
		s1[i+1] --; //jiewei
		}
		if(s1[i])
			largest = i;
	}
	return largest;
}

int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%s",num1);
		scanf("%s",num2);
		int i,j;
		memset(s1,0,sizeof(s1));
		memset(s2,0,sizeof(s2));
		int n1=strlen(num1);
		for(j=0,i=n1-1;i>=0;i--)
			s1[j++]=num1[i]-'0';
		int n2=strlen(num2);
		for(j=0,i=n2-1;i>=0;i--)
			s2[j++]=num2[i]-'0';
		int largest = Minus(MAX,s1,s2);
		for(i=largest;i>=0;i--)
			printf("%d",s1[i]);
		printf("\n");
	}
	return 0;
}


int main()
{
	void zuocha(void);
	int k,n;
	cin >> n;
	for (k=1;k<=n;k++)
		zuocha();
	return 0;
}

void zuocha(void)
{
	char str1[100],str2[100];
	int l1,l2;
	cin >> str1 >> str2;
	l1=strlen(str1);
	l2=strlen(str2);

	int num1[100],num2[100],cha[100];
	int i,j;

	for (i=0;i<l1;i++)
		num1[l1-1-i]=str1[i]-'0';
	for (i=0;i<l2;i++)
		num2[l2-1-i]=str2[i]-'0';
	for (i=l2;i<l1;i++)
		num2[i]=0;

	for (i=0;i<l1;i++)
		if (num1[i]>=num2[i])
		{
			cha[i]=num1[i]-num2[i];
		}
		else
		{
			cha[i]=num1[i]+10-num2[i];
			num1[i+1] -=1;
		}

	for (i=l1-1;i>=0;i--)
		if (cha[i]!=0)
			break;
	for (j=i;j>=0;j--)
		cout << cha[j];
	cout << endl;
}


char input[1000][256],output[1000][256];
int main()
{
	int n,i,j,len;
	scanf("%d",&n);

	char input[1000][256],output[1000][256];
	for(i=0;i<n;i++)
	{
		scanf("%s",input[i]);
	}

	for(i=0;i<n;i++)
	{
		len=strlen(input[i]);
		for(j=0;j<len;j++)
		{
			if(input[i][j]=='A')
				output[i][j]='T';
			if(input[i][j]=='T')
				output[i][j]='A';
			if(input[i][j]=='C')
				output[i][j]='G';
			if(input[i][j]=='G')
				output[i][j]='C';
		}
		output[i][len]='\0';
	}

	for(i=0;i<n;i++)
	{
		printf("%s\n",output[i]);
	}

	return 0;
}


int main(int argc, char* argv[])
{
	int n,i,j,len;
	char jianji[1000][300];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",jianji[i]);
	}
	for (i=0;i<n;i++)
	{
		len=strlen(jianji[i]);
		for (j=0;j<len;j++)
		{
			if (jianji[i][j]=='A')
			{
				jianji[i][j]='T';
			}
			else if (jianji[i][j]=='T')
			{
				jianji[i][j]='A';
			}
			else if (jianji[i][j]=='C')
			{
				jianji[i][j]='G';
			}
			else if (jianji[i][j]=='G')
			{
				jianji[i][j]='C';
			}
		}

	}
	for (i=0;i<n;i++)
	{
		printf("%s\n",jianji[i]);
	}
	return 0;
}


int main(){
	int n;
	scanf("%d",&n);
	int i;
	char **oldjianji=(char**)malloc(sizeof(char*)*n);
	for(i=0;i<n;i++){
		oldjianji[i]=(char*)malloc(sizeof(char)*256);
	}
	int j;
	int *len=(int*)malloc(sizeof(int)*n);
	for(i=0;i<n;i++){
		scanf("%s",oldjianji[i]);
		len[i]=strlen(oldjianji[i]);
	}
	char **jianji=(char**)malloc(sizeof(char*)*n);
	for(i=0;i<n;i++){
		jianji[i]=(char*)malloc(sizeof(char)*len[i]+1);
	}

	for(i=0;i<n;i++){
		for(j=0;j<len[i];j++){
			if(oldjianji[i][j]=='A'){
				jianji[i][j]='T';
			}else if(oldjianji[i][j]=='T'){
				jianji[i][j]='A';
			}else if(oldjianji[i][j]=='C'){
				jianji[i][j]='G';
			}else if(oldjianji[i][j]=='G'){
				jianji[i][j]='C';
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%s\n",jianji[i]);
	}
free(jianji);
free(oldjianji);
free(len);
return 0;
}


int main()
{
	int n;
	scanf("%d\n",&n);
	int i;
	for(i=0;i<n;i++)
	{
		char m;
		do
		{
			scanf("%c",&m);
			if (m=='A')
			{
				printf("T");
			}
			else if(m=='T')
			{
				printf("A");
			}
			else if(m=='G')
			{
				printf("C");
			}
			else if(m=='C')
			{
				printf("G");
			}
		}while(m!='\n');
		printf("\n");
	}
	return 0;
}


int main()
{
    int n;
    char str[300];
    cin>>n;
    while(n --)
    {
            cin>>str;
            int len = strlen(str);
            for(int i = 0; i < len; i ++)
            {
                    if(str[i]== 'A') str[i] = 'T';
                    else if(str[i]== 'T') str[i] = 'A';
                    else if(str[i]== 'C') str[i] = 'G';
                    else if(str[i]== 'G') str[i] = 'C';
                    cout<<str[i];
            }
            cout<<endl;
    }
    return 0;
}


int main()
{
	char	words[500];
	int		N;
	cin >> N;
	cin.get();

	for (int i = 0; i < N; i ++)
	{
		cin.getline(words, 500);
		char *p = words;
		while(*p != '\0')
		{
			if(*p == 'A')
			{cout << 'T';}
			else if(*p == 'T')
			{cout << 'A';}
			else if(*p == 'C')
			{cout << 'G';}
			else if(*p == 'G')
			{cout << 'C';}
			p ++;
		}
		cout << endl;
	}
	return 0;
}


int main()
{
	int n, i, j;
	char **dna;
	scanf("%d", &n);
	dna=(char**)malloc(sizeof(char*)*n);
	for (i=0;i<n;i++)
		dna[i]=(char*)malloc(sizeof(char)*255);

	for (i=0;i<n;i++)
		scanf("%s",dna[i]);

	char ch;

	for (i=0;i<n;i++)
	{
		for (j=0;(ch=dna[i][j])!=0;j++)
		{
			switch(ch)
			{
			case 'A':
				printf("T");
				break;
			case 'T':
				printf("A");
				break;
			case 'G':
				printf("C");
				break;
			case 'C':
				printf("G");
				break;
			}
		}
		printf("\n");
	}

	for (i=0;i<n;i++)
		free(dna[i]);
	free(dna);
	return 0;
}


struct DNA{
	char zfc[255];
}a[1000];
int main()
{
	int n,i,j,t;
	scanf("%d\n",&n);
	for(i=0;i<n;i++){
	gets(a[i].zfc);
		t=strlen(a[i].zfc);
		for(j=0;j<t;j++){
			if(a[i].zfc[j]=='A')
				a[i].zfc[j]='T';
	        else if(a[i].zfc[j]=='T')
		        a[i].zfc[j]='A';
	        else if(a[i].zfc[j]=='C')
		        a[i].zfc[j]='G';
	        else if(a[i].zfc[j]=='G')
		        a[i].zfc[j]='C';
		}
		puts(a[i].zfc);
	}
    return 0;
}


int main()
{
	int i,j,n;
	char a[256],b[5];
	scanf("%d",&n);
	gets(b);
	for(i=0;i<n;i++)
	{
		gets(a);//gets(a);
		for(j=0;a[j]!='\0';j++)
		{
			switch(a[j])
			{
				case 'A':a[j]='T';break;
				case 'T':a[j]='A';break;
				case 'C':a[j]='G';break;
				case 'G':a[j]='C';break;
			}
		}
		puts(a);
		//printf("%s",a);
	}
	return 0;
}


void main ()
{  int n,i,j,k,a;
char s[500];
  scanf("%d\n",&n);

   for(i=0;i<n;i++)
   { gets(s);
    a=strlen(s);
	for(j=0;j<a;j++)
	{if(s[j]=='A')
	printf("T");
if(s[j]=='T')
	printf("A");
if(s[j]=='C')
	printf("G");
if(s[j]=='G')
	printf("C");
	}
printf("\n");
   }

}


int main ()
{
    int m,n,i,j;
    scanf("%d",&n);
    getchar();
    for(i=0;i<n;i++)
    {
    char a[MAX+1],b[MAX+1];
    scanf("%s",a);
        for(j=0;a[j];j++)
        {
          switch(a[j])
          {
                case'A':b[j]='T';
                break;
                case'T':b[j]='A';
                break;
                case'G':b[j]='C';
                break;
                case'C':b[j]='G';
                break;
                default:b[j]=a[j];
                break;
           }
         }
      b[j]=a[j];
      printf("%s\n", b);
    }
	return 0;
}


int main(){
int n;
char c[300];
scanf("%d",&n);
getchar();
for (int j=0;j<n;j++){
   gets(c);
   for (int i=0;i<strlen(c);i++){
	 if (c[i]=='A') {
      printf("T");
     }
     if (c[i]=='T') {
      printf("A");
     }
     if (c[i]=='G') {
      printf("C");
     }
     if (c[i]=='C') {
      printf("G");
     }
    if (i==(strlen(c)-1)){
      printf("\n");
	 }
	}
}
return 0;
}


void main()
{
	char f(char x);
	int n, i, j;
	char s[256];
	scanf("%d\n", &n);
	for(i=0; i<n; i++)
	{
		gets(s);
		for(j=0; s[j]!='\0'; j++)
			s[j]=f(s[j]);
		s[j]='\0';
		puts(s);
	}
}
char f(char x)
{
	switch(x)
	{
	case 'A': return 'T'; break;
	case 'T': return 'A'; break;
	case 'C': return 'G'; break;
	case 'G': return 'C'; break;
	}
}


int main(){
	int n,len;
	scanf("%d",&n);
	char dna[256];
	char hubu[256];
	for(int i=0;i<n;i++){
		scanf("%s",dna);
		len=strlen(dna);
		for(int r=0;r<=len;r++){
			if(dna[r]-'A'==0){
				hubu[r]='T';
			}else if(dna[r]-'T'==0){
				hubu[r]='A';
			}else if(dna[r]-'C'==0){
				hubu[r]='G';
			}else if(dna[r]-'G'==0){
				hubu[r]='C';
			}else{
				hubu[r]=0;
			}
		}
		printf("%s\n",hubu);
	}
    return 0;
}


int main()
{
   int n,len,i,j;
   char str[256];
   cin>>n;
   for(i=0;i<n;i++)
   {
      cin>>str;
	  len=strlen(str);
	  for(j=0;j<len;j++)
	  {
	     switch(str[j])
		 {
		    case 'A': cout<<'T';break;
            case 'T': cout<<'A';break;
			case 'C': cout<<'G';break;
			case 'G': cout<<'C';break;
		 }
	  }
	  cout<<endl;
   }
   return 0;
}


int main(){
	int n,i,j;
	char zf[300],pd[300];
	scanf("%d",&n);
for(i=0;i<n;i++){
	scanf("%s",zf);
	int l=strlen(zf);
	for(j=0;j<l;j++){
		if(zf[j]=='A'){
			pd[j]='T';
			continue;}
		if(zf[j]=='T'){
		pd[j]='A';
continue;}
		if(zf[j]=='C'){
			pd[j]='G';
			continue;}
		if(zf[j]=='G'){
			pd[j]='C';
			continue;}}
	pd[strlen(zf)]='\0';
		printf("%s\n",pd);}

return 0;
}


int main(){
	char zfc[256],*ps;
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		char e[256]={0};
	    scanf("%s",zfc);
		for(ps=zfc;*ps!='\0';ps++){
			if(*ps=='A'){
				strcat(e,"T");
			}else if(*ps=='T'){
				strcat(e,"A");
			}else if(*ps=='G'){
                strcat(e,"C");
			}else{
				strcat(e,"G");
			}
		}

		printf("%s\n",e);
	}
return 0;
}


int main(){
char s[MAX+1];
int i,j,n,l;
char A,T,G,C;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%s",s);
l=strlen(s);
for(j=0;j<l;j++)
{
if (s[j]=='T')     printf("A");
if (s[j]=='A')     printf("T");
if (s[j]=='G')     printf("C");
if (s[j]=='C')     printf("G");
}
printf("\n");
}
return 0;
}


int main()
{
    int n;
	scanf("%d",&n);
	int i;
	char a[2000];
	for(i=0;i<=n;i++)
	{
       gets(a);
int j;
	   for(j=0;j<strlen(a);j++)
		{
			switch(a[j])
			{
			case 'A':
				a[j]='T';
				break;
			case 'T':
				a[j]='A';
				break;
				case 'C':
				a[j]='G';
				break;
				case 'G':
				a[j]='C';
				break;
			}
		}
		int k;
		for(k=0;k<strlen(a);k++)
		{
			printf("%c",a[k]);
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n,i=0,k=0;
	char jianji[1000][1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",jianji[i]);
	}
	for(i=0;i<n;i++)
	{
		for(k=0;k<strlen(jianji[i]);k++)
		{
			switch(jianji[i][k]){
			case 'T':
				jianji[i][k]='A';break;
			case 'A':
				jianji[i][k]='T';break;
			case 'G':
				jianji[i][k]='C';break;
			case 'C':
				jianji[i][k]='G';break;
			default:
				jianji[i][k]=0;break;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		printf("%s\n",jianji[i]);
	}
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	int i,a;
	for(i=0;i<n;i++)
	{
		char zfc[256];
		scanf("%s",zfc);
        a=strlen(zfc);
		int j;
		for(j=0;j<a-1;j++)
		{
			if(zfc[j]=='A')  printf("%c",'T');

            else if(zfc[j]=='T') printf("%c",'A');

            else if(zfc[j]=='G') printf("%c",'C');

            else if(zfc[j]=='C') printf("%c",'G');

		}
            if(zfc[j]=='A') printf("%c\n",'T');
            else if(zfc[j]=='T') printf("%c\n",'A');
            else if(zfc[j]=='G') printf("%c\n",'C');
            else if(zfc[j]=='C') printf("%c\n",'G');
	}
	return 0;
}


int main()
{
	char x[1000];
	int i,changdu,n,t=0;
	scanf("%d",&n);
	while(t<n)
	{
		memset(x,0,sizeof(x));
		scanf("%s",x);
		changdu=strlen(x);
		for(i=0;i<changdu;i++)
		{
			if(x[i]=='A')printf("T");
			else if(x[i]=='T')printf("A");
			else if(x[i]=='C')printf("G");
			else if(x[i]=='G')printf("C");
		}
		printf("\n");
		changdu=i=0;
		t++;
	}
	return 0;
}


int main()
{
	int n,i,j,len[N];
	char sz[N][N];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&sz[i]);
		len[i]=strlen(sz[i]);
	}
		for(i=0;i<n;i++)
	{
			for(j=0;j<len[i];j++)
			{
				if(sz[i][j]=='A')
				{
					printf("T");

				}
				else if(sz[i][j]=='G')
				{
					printf("C");

				}
				else if(sz[i][j]=='C')
				{
					printf("G");

				}
				else if(sz[i][j]=='T')
				{
					printf("A");

				}
			}
		    printf("\n");
		}

		return 0;
}


int main()
{
	int i,j,n,len;
	char zfc[1000][256];
	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s",zfc[i]);
		len=strlen(zfc[i]);
		for(j=0;j<len;j++)
		{
			if(zfc[i][j]=='A')
				printf("T");
			else if(zfc[i][j]=='T')
				printf("A");
			else if(zfc[i][j]=='G')
				printf("C");
			else
				printf("G");
		}
		printf("\n");

	}

	return 0;
}


char peidui(char x);
char peidui(char x){
   char s;
   s=0;
   if(x=='A'){s='T';}
   if(x=='T'){s='A';}
   if(x=='C'){s='G';}
   if(x=='G'){s='C';}
   return s;
}
int main(){
   int n,i,j,len;
   char jianji[256];
   scanf("%d",&n);
   for(i=0;i<n;i++){
   len=0;
   scanf("%s",jianji);
   len=strlen(jianji);
   for(j=0;j<len;j++){
   printf("%c",peidui(jianji[j]));
               }
   printf("\n");
   }

   return 0;
}


int main()
{
	int n;
	char a;//[300];
	scanf("%d",&n);
	scanf("%c", &a);
	while (n--)
	{
		while (1)
		{
			scanf("%c", &a);
			if(a=='A')
				printf("T");
			if(a=='T')
				printf("A");
			if(a=='C')
				printf("G");
			if(a=='G')
				printf("C");
			if (a=='\n') {
				printf("\n");
				break;
			}
		}
		//memset(a, 0, sizeof(a));
	}
	return 0;
}


int main()
{
   int n;
   int i, j;
   char string[256];

   scanf("%d\n", &n);
   for(i = 0; i < n ; i++)
   {
       gets(string);
       for(j = 0; j < strlen(string); j++)
       {
          if(string[j] == 'A')
            printf("T");
          else if(string[j] == 'T')
            printf("A");
          else if(string[j] == 'G')
            printf("C");
          else if(string[j] == 'C')
            printf("G");
       }
       printf("\n");
    }
  return 0;
}


int main(){
    int n,len;
    scanf("%d",&n);
    char zfc[1000][256];
    for (int a=0;a<n;a++){
        scanf("%s",zfc[a]);
    }
    for(int b=0;b<n;b++){
        len=strlen(zfc[b]);
        for(int c=0;c<len;c++){
            if(zfc[b][c]=='A'){zfc[b][c]='T';}else
            if(zfc[b][c]=='T'){zfc[b][c]='A';}else
            if(zfc[b][c]=='C'){zfc[b][c]='G';}else
            if(zfc[b][c]=='G'){zfc[b][c]='C';}
        }
    }
   for (int a=0;a<n-1;a++){
        printf("%s\n",zfc[a]);
    }
     printf("%s",zfc[n-1]);
    return 0;
}


void f(char s[260],int n)
{
	int i;
	for(i=0;i<n;i++)
	{
		switch(s[i])
		{
		case 'A':printf("T");
			     break;
		case 'T':printf("A");
			     break;
		case 'G':printf("C");
			     break;
		case 'C':printf("G");
			     break;
		}
	}
	printf("\n");
}
int main()
{
	int t,n,i;
	char s[260];
	scanf("%d\n",&t);
	for(i=0;i<t;i++)
	{
		gets(s);
        n=strlen(s);
        f(s,n);
	}
   return 0;
}


int main()
{
int n;
    scanf("%d",&n);
    char zfc[300];
int len;

    for(int i=0;i<n;i++){
    scanf("%s",zfc);

            len=strlen(zfc);
      for(int j=0;j<len;j++){
         if(zfc[j]=='A')
           zfc[j]='T';
          else if(zfc[j]=='T')
           zfc[j]='A';
         else if(zfc[j]=='G')
           zfc[j]='C';
         else if(zfc[j]=='C')
           zfc[j]='G';
}
          printf("%s\n",zfc);

}
     return 0;
}


int main()
{int n;
cin>>n;

int i=0,cnt=0;
for(i=0;i<n;i++)
scanf("%s",s[i]);

for(int j=0;j<n;j++)
{
for(i=0;s[j][i]!='\0';i++)
{
if(s[j][i]=='A')
printf("T");
else if(s[j][i]=='T')
printf("A");
else if(s[j][i]=='C')
printf("G");
else if(s[j][i]=='G')
printf("C");
}
printf("\n");
}

    return 0;
}


int main()
{
	int n,len,i,j;
	char a[256];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&a);
		len=strlen(a);
		for(j=0;j<len;j++)
		{
			switch(a[j])
			{
			case 65:{a[j]=84;break;}
			case 84:{a[j]=65;break;}
			case 71:{a[j]=67;break;}
			case 67:{a[j]=71;break;}
			}
		}
		a[len]=0;
		printf("%s\n",a);
	}
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	while (n--)
	{
		char a[500];
		scanf("%s",&a);
		int LL = strlen(a);
		for (int i=0; i<LL;i++ )
		{
			if (a[i]=='A')
				printf("T");
			if (a[i]=='T')
				printf("A");
			if (a[i]=='G')
				printf("C");
			if (a[i]=='C')
				printf("G");
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n,i;
	scanf("%d",&n);
	getchar();
	char base[256],*p;
	for(i=0;i<n;i++)
	{
		scanf("%s",&base);
		p=base;
		for(;p<=&base[strlen(base)-1];p++)
		{
			if(*p=='A')
			{
				printf("T");
			}
			if(*p=='T')
			{
				printf("A");
			}
			if(*p=='C')
			{
				printf("G");
			}
			if(*p=='G')
			{
				printf("C");
			}
			if(p==&base[strlen(base)-1])
			{
				printf("\n");
			}
		}
	}
	return 0;
}


int main()
{
	int i,a,n,k;
	char dna[256];
	scanf("%d",&n);
	for(k=0;k<n;k++)
	{
		scanf("%s",dna);
	    a=strlen(dna);
		if(k!=0)
			printf("\n");
        for(i=0;i<a;i++)
		{
			if(dna[i]=='A')
			    printf("%c",'T');
		    else if(dna[i]=='T')
			    printf("%c",'A');
		    else if(dna[i]=='C')
		    	printf("%c",'G');
		    else if(dna[i]=='G')
 		    	printf("%c",'C');
		}
	}
return 0;
}


int main()
{
	char jj[500];
    int l;
	int n;
	int j,i;

    scanf("%d",&n);
	for(j=0;j<=n;j++)
	{

	   gets(jj);
       l=strlen(jj);

	   for(i=0;i<l;i++)
	   {
		  if(jj[i]=='A')
		  {
			 jj[i]='T';
		  }
		  else if(jj[i]=='T')
		  {
			 jj[i]='A';
		  }
		  else if(jj[i]=='C')
		  {
			 jj[i]='G';
		  }
		  else
		  {
			 jj[i]='C';
		  }
	   }

	   puts(jj);
	   printf("\n");

	}

	return 0;

}


int main(){
    int n, i,k,j;
    char DNA[MAX],S[MAX];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s", DNA);
        for(k=0;DNA[k];k++){
            switch(DNA[k]){
                case'A':S[k]='T';break;
                case'T':S[k]='A';break;
                case'G':S[k]='C';break;
                case'C':S[k]='G';break;
                default:S[k]=DNA[k];break;
            }
        }
        S[k] = DNA[k];
        printf("%s\n", S);
    }
    return 0;
}


int main()
{
	int n,i,j;
	char word[10000][256];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s\n",word[i]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<256;j++){
			if(word[i][j]=='A'){
				word[i][j]='T';
				continue;
			}
			else if(word[i][j]=='T'){
                word[i][j]='A';
                continue;

			}
            else if(word[i][j]=='G'){
                word[i][j]='C';
                continue;

			}
            else if(word[i][j]=='C'){
                word[i][j]='G';
                continue;

			}
		}
			}
for(i=0;i<n;i++)
{
printf("%s\n",word[i]);
}

	return 0;
}


int main()
{
	int n,i,j,len;
	char ori[999][256],tra[999][256];
	scanf("%d",&n);
	for(i=0;i<n;i++)
		scanf("%s",ori[i]);
	for(i=0;i<n;i++)
	{
		len=strlen(ori[i]);
		for(j=0;j<len;j++)
			switch(ori[i][j])
		   {
			case'A':tra[i][j]='T';break;
			case'T':tra[i][j]='A';break;
			case'G':tra[i][j]='C';break;
			case'C':tra[i][j]='G';
		   }
		tra[i][len]='\0';
	}
	for(i=0;i<n;i++)
		printf("%s\n",tra[i]);

	return 0;
}


int main()
{
	int n;
	char lian[1000][260];
	scanf("%d", &n);
	for(int i=0;i<n;i++){
		scanf("%s", lian[i]);
		int m=0;
		while(lian[i][m]!='\0'){
			if(lian[i][m]=='A'){
				lian[i][m]='T';
			}
			else if(lian[i][m]=='T'){
				lian[i][m]='A';
			}
			else if(lian[i][m]=='G'){
				lian[i][m]='C';
			}
			else if(lian[i][m]=='C'){
				lian[i][m]='G';
			}
			m++;
		}
		printf("%s\n", lian[i]);
	}
	return 0;
}


void com(char seq[])
{
     int len = strlen(seq);
     int i;

     for(i = 0; i <= len - 1; i++)
           switch(seq[i])
           {
                         case 'A':
                              printf("T");
                              break;
                         case 'T':
                              printf("A");
                              break;
                         case 'G':
                              printf("C");
                              break;
                         case 'C':
                              printf("G");
                              break;
           }

     printf("\n");
}

int main()
{
    int n;
    scanf("%d\n", &n);

    char seq[256];
    int i;
    for(i = 1; i <= n; i++)
    {
          gets(seq);
          com(seq);
    }

    return 0;
}


int main()
{
	int n,jishu;
	int i,j;
	char jianji[1001];
	scanf("%d\n`", &n);
	for(i=1;i<=n;i++)
	{
		for(j=1;j<=1000;j++)
		{
			jianji[j]=getchar();
			if(jianji[j]=='\n')
			{
				jishu=j;break;
			}
		}
		for(j=1;j<=jishu;j++)
		{
			switch(jianji[j])
			{
			case 'A':
			printf("T");break;
			case 'T':
				printf("A");break;
			case 'C':
				printf("G");break;
			case 'G':
				printf("C");break;
			default:
				printf("\n");break;
			}
		}
	}
	return 0;
}


int main()
{
	int n,i,k;
	char zfc[1000][256];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&zfc[i]);
	}
	for(i=0;i<n;i++)
	{
		for (k=0; zfc[i][k]!=0; k++)
		{
            switch (zfc[i][k])
			{
            case 'A':
				zfc[i][k] = 'T';
                break;
            case 'G':
                zfc[i][k] = 'C';
                break;
            case 'T':
                zfc[i][k] = 'A';
                break;
            case 'C':
                zfc[i][k] = 'G';
                break;
            }

		}
	}
	for(i=0;i<n;i++)
	{
		printf("%s\n",zfc[i]);
	}
	return 0;
}


int main(){
	int n;
	scanf("%d",&n);
	char suoyou[1000][256];
	int i=0;
	for(i=0;i<n+1;i++){
		gets(suoyou[i]);
	}
	int k=0;
	for(i=0;i<n+1;i++){
		for(k=0;k<strlen(suoyou[i]);k++){
			if(suoyou[i][k]==65){
				suoyou[i][k]=84;
			}else if(suoyou[i][k]==84){
				suoyou[i][k]=65;
			}else if(suoyou[i][k]==67){
				suoyou[i][k]=71;
			}else{
				suoyou[i][k]=67;
			}
		}
	}
	for(i=0;i<n+1;i++){
		printf("%s\n",suoyou[i]);
	}
	return 0;
}


int main(){
	int n,i,j;
	char s[256];
	char A,G,C,T;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		for(j=0;s[j];j++){
			switch(s[j]){
				case'A':
					s[j]='T';
					break;
				case'G':
					s[j]='C';
					break;
				case'C':
					s[j]='G';
					break;
				case'T':
					s[j]='A';
					break;
			}
		}
		printf("%s\n",s);
	}
	return 0;
}


int main(int argc, char *argv[])
{
    int n,i,m,len;
    char a[256];
    scanf("%d",&n);
    for(m=0;m<n;m++){
                     scanf("%s",a);
                     len=strlen(a);
                     for(i=0;i<len;i++){
                                        switch(a[i]){
                                                     case 'A':{a[i]='T';break;}
                                                     case 'T':{a[i]='A';break;}
                                                     case 'C':{a[i]='G';break;}
                                                     case 'G':a[i]='C';
                                                     }
                                                     }
                     for(i=0;i<len;i++) printf("%c",a[i]);
                     printf("\n");
                     }

  return 0;
}


int main()
{
	char str[256];
	char ch;
	int a,n,i=0,j=0;
	scanf("%d%c",&n,&ch);
	while(i++<n)
	{
		gets(str);
		a=strlen(str);
		if(str[0]=='A')
			{
				printf("T");
			}else if(str[0]=='C')
			{
				printf("G");
			}else if(str[0]=='G')
			{
				printf("C");
			}else if(str[0]=='T')
			{
				printf("A");
			}
		while(j++<a)
		{
			if(str[j]=='A')
			{
				printf("T");
			}else if(str[j]=='C')
			{
				printf("G");
			}else if(str[j]=='G')
			{
				printf("C");
			}else if(str[j]=='T')
			{
				printf("A");
			}
		}
		printf("\n");
		j=0;
	}
}


int main()
{
	int n,i,len,j;
	char s[1000][255];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s[i]);
		len=strlen(s[i]);
		for(j=0;j<len-1;j++)
		{
			if(s[i][j]=='A') printf("T");
            else if(s[i][j]=='T') printf("A");
            else if(s[i][j]=='G') printf("C");
            else if(s[i][j]=='C') printf("G");
		}
            if(s[i][len-1]=='A') printf("T\n");
            else if(s[i][len-1]=='T') printf("A\n");
            else if(s[i][len-1]=='G') printf("C\n");
            else if(s[i][len-1]=='C') printf("G\n");

	}
	return 0;
}


int main()
{
    int n;
    scanf("%d",&n);
    char num[256];
    for(int i=0;i<=n;i++)
    {

        gets(num);
        for(int j=0;j<=255;j++)
        {
            if(num[j]=='A')
            num[j]='T';
            else if(num[j]=='C')
            num[j]='G';
            else if(num[j]=='G')
            num[j]='C';
            else if(num[j]=='T')
            num[j]='A';
            if(num[j]=='\0')
            {printf("%s\n",num);break;}
        }
    }
    return 0;
}


int main(){
	int n,a,b,c,d,e,f,i,j;
    char sz[1000][500];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",sz[i]);
		for(j=0;j<strlen(sz[i]);j++){
			if(sz[i][j]=='A'){
				printf("T");
			}else if(sz[i][j]=='G'){
				printf("C");
			}else if(sz[i][j]=='T'){
				printf("A");
			}else if(sz[i][j]=='C'){
				printf("G");
			}
		}
		printf("\n");
	}

	return 0;
}


int main(int argc, char* argv[])
{
	int n,len,i,j;
	char a[256];

	scanf("%d",&n);
	for (i=0;i<=n;i++)
	{
		gets(a);
		len=strlen(a);
		for (j=0;j<len;j++)
		{
			if (a[j]=='A')
			{
				printf("T");
			}
			if (a[j]=='T')
			{
				printf("A");
			}
			if (a[j]=='C')
			{
				printf("G");
			}
			if (a[j]=='G')
			{
				printf("C");
			}
		}
		printf("\n");
	}

	return 0;
}


int main()
{
	int n,x;
	scanf("%d ",&n);
	for(x=0;x<n;x++)
	{
		char c[256]={'\0'};
		scanf("%s",c);
		int i,len;
		len=strlen(c);
		for(i=0;i<len;i++)
		{
			if(c[i]=='A')
			{
				c[i]='T';
				continue;
			}
			if(c[i]=='T')
			{
				c[i]='A';
				continue;
			}
			if(c[i]=='C')
			{
				c[i]='G';
				continue;
			}
			if(c[i]=='G')
			{
				c[i]='C';
				continue;
			}
		}
		if(x<n-1)
		printf("%s\n",c);
		else
			printf("%s",c);
	}
	return 0;
}


int main()
{
	int n,i,j,num;
	char a[256],b[256];
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++){
		gets(a);
		num=strlen(a);
		for(j=0;j<num;j++){
			switch(a[j])
			{
			case'A':b[j]='T';continue;
			case'T':b[j]='A';continue;
			case'C':b[j]='G';continue;
			case'G':b[j]='C';continue;
			}
		}
		for(j=0;j<num;j++){
			printf("%c",b[j]);
		}
		printf("\n");
	}
	return 0;
}


int main()
{
  int n;
  scanf("%d",&n);
  while(n--){
  char s[256];
  int i;
  scanf("%s",s);
  int len=strlen(s);
  for(i=0;i<len;i++){
  if(s[i]=='A')
     s[i]='T';
  else if(s[i]=='T')
	  s[i]='A';
  else if(s[i]=='C')
      s[i]='G';
  else if(s[i]=='G')
	  s[i]='C';
  }
  printf("%s\n",s);

  }
  return 0;
}


int main()
{
	char q;
	int n;
	scanf("%d",&n);
	scanf("%c",&q);
	int i,j,k,b,u;
	b=0;
	char byte[256];
	for(u=0;u<n;u++)
	{
	    scanf("%s",byte);
	    b=strlen(byte);
     	for(j=0;j<b;j++)
		{
	    	switch(byte[j])
			{
	    	case'T':
	     		byte[j]='A';
	    		break;
	     	case'A':
		    	byte[j]='T';
	    		break;
	    	case'C':
	    		byte[j]='G';
	      		break;
	    	case'G':
	      		byte[j]='C';
		    	break;
			}
		}
    	for(k=0;k<b;k++)
		{
     		printf("%c",byte[k]);
		}
		printf("\n");
	}

	return 0;
}


int main()
{
    int n,m,i,j;
    char s[256];
    scanf("%d",&n);
    scanf("\n");
    for(i=0;i<n;i++){
        scanf("%s",&s);
        scanf("\n");
        m=strlen(s);
        for(j=0;j<m;j++){
            if(s[j]=='A'){
                s[j]='T';
                continue;
            }
            else if(s[j]=='T'){
                s[j]='A';
                continue;
            }
            else if(s[j]=='C'){
                s[j]='G';
                continue;
            }
            else if(s[j]=='G'){
                s[j]='C';
                continue;
            }
        }
        printf("%s",s);
        printf("\n");
    }
    return 0;
}


void main(){
	char str[1000][260];
	int n,i,j,p;
    scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",&str[i]);
	}
	for(i=0;i<n;i++){
		p=strlen(str[i]);
		for(j=0;j<p;j++){
			switch(str[i][j]){
			case'A':str[i][j]='T';break;
			case'T':str[i][j]='A';break;
			case'G':str[i][j]='C';break;
			case'C':str[i][j]='G';break;
			}
		}
	}
	for(i=0;i<n;i++){
		printf("%s\n",str[i]);
	}
}


char st[1000][256];
int n,i,l,j;
int main()
{
    scanf ("%d",&n);
	for (i=0;i<n;i++)
	{
	scanf("%s",st[i]);
	l=strlen(st[i]);
	for (j=0;j<=l;j++)
	{
		if (st[i][j]=='A')
			printf("T");
		else if (st[i][j]=='T')
		    printf("A");
		else if (st[i][j]=='C')
			printf("G");
		else if (st[i][j]=='G')
			printf("C");
	}
	printf("\n");
	}
	return 0;
}


int main()
{
	int n;
	scanf("%d",&n);
	char zfc[1000];
gets(zfc);
	for(int j=0;j<n;j++)
	{
	   gets(zfc);
    	for(int i=0;;i++)
	{
		if(zfc[i]=='A')
		{
			printf("T");
			continue;
		}
        if(zfc[i]=='T')
		{
			printf("A");
			continue;
		}
		if(zfc[i]=='C')
		{
			printf("G");
			continue;
		}
		if(zfc[i]=='G')
		{
			printf("C");
			continue;
		}

        if(zfc[i]=='\0')
		{
			printf("\n");
        	break;
		}
	}
	}
	return 0;
}


int main()
{
	int i,j;
	int n;
	char A='A',T='T',C='C',G='G';
	char s[MAX+1];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",s);
		for(j=0;s[j];j++){
			switch (s[j]){
			case'A':s[j]=T;break;
			case'T':s[j]=A;break;
			case'C':s[j]=G;break;
			case'G':s[j]=C;break;
			}
		}
		printf("%s\n",s);
	}
	return 0;
}


int main(){
 int n,i,k;
 char zfc0[100];
 gets(zfc0);
 n=atoi(zfc0);
 for(i=0;i<n;i++){
 char zfc[256];
 gets(zfc);

 int a;
 a=strlen(zfc);
 for(k=0;k<a;k++){
  if(zfc[k]=='A'){
  zfc[k]='T';
  }
  else if(zfc[k]=='G'){
  zfc[k]='C';
  }
  else if(zfc[k]=='C'){
  zfc[k]='G';
  }
  else if(zfc[k]=='T'){
  zfc[k]='A';
  }else{
      zfc[k]='\0';
  }}
 printf("%s\n",zfc);
 }
return 0;
}


int main(){
  int i,l,n,j;
  char zfc[300];
  scanf("%d",&n);
  for(i=0;i<n;i++){
   scanf("%s",zfc);
   l=strlen(zfc);
  for(j=0;j<l;j++){
   if(zfc[j]=='A') zfc[j]='T';
   else if(zfc[j]=='T') zfc[j]='A';
   else if(zfc[j]=='C') zfc[j]='G';
   else if(zfc[j]=='G') zfc[j]='C';
 }
   printf("%s\n",zfc);
}

return 0;
}


char chaina[1000][260], chainb[1000][260];
int len;
int main()
{
	int n, i, j;
	scanf("%d", &n);
	for(i=0; i<n; i++)
	{
		scanf("%s", chaina[i]);
		len=strlen(chaina[i]);
		for(j=0; j<len; j++)
		{
			switch(chaina[i][j])
			{
			   case 'A':
				   chainb[i][j]='T';
				   break;
			   case 'T':
				   chainb[i][j]='A';
				   break;
			   case 'C':
				   chainb[i][j]='G';
				   break;
			   case 'G':
				   chainb[i][j]='C';
			}
		}
	}
	for(i=0; i<n; i++)
		printf("%s\n", chainb[i]);
	return 0;
}


int main(int argc, char* argv[])
{
    int n,len=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		char s[256];
		scanf("%s",s);
        len=strlen(s);
		for(int j=0;j<len;j++)
		{
			if(s[j]=='A')  printf("T");
            if(s[j]=='T')  printf("A");
			if(s[j]=='C')  printf("G");
			if(s[j]=='G')  printf("C");
		}
		printf("\n");
	}
	return 0;
}


int main (){
	int n,i,j;
	char s[MAX+1];
	scanf ("%d",&n);
	for (i=0;i<=n;i++){
		gets(s);
		for(j=0;s[j];j++){
			switch (s[j]){
			case'A':s[j]='T';break;
			case'T':s[j]='A';break;
			case'C':s[j]='G';break;
			case'G':s[j]='C';break;
			}
		}
		puts(s);
	}
	return 0;

}


int main()
{
	int n,i,l,j;
	char dna[256],change[256];
	scanf("%d",&n);
	for (i=0;i<n;i++)
	{
		scanf("%s",&dna);
		l = strlen(dna);
		for (j=0;j<l;j++)
		{
			if (dna[j] == 'A')
				change[j] = 'T';
			else if (dna[j] == 'T')
				change[j] = 'A';
			else if (dna[j] == 'C')
				change[j] = 'G';
			else
				change[j] = 'C';
		}
		change[l] = '\0';
		printf("%s\n",change);
	}
	return 0;
}


int main()
{
    int n,i,j;
    char a[256];
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%s",a);
        for(j=0;a[j]!='\0';j++)
	{
	    if(a[j]=='C') printf("G");
	    else if(a[j]=='G') printf("C");
	    else if(a[j]=='T') printf("A");
	    else printf("T");
	}
    printf("\n");
    }
    return 0;
}


int main()
{
    int n,i,j;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
	      char a[260],b[260];
		  scanf("%s",a);
		  int l;
		  l=strlen(a);
		  for(j=0;j<l;j++)
		  {
		        switch(a[j])
				{
				     case'A':
						 b[j]='T';
						 break;
					 case'T':
						 b[j]='A';
						 break;
					 case'C':
						 b[j]='G';
						 break;
					 case'G':
						 b[j]='C';
						 break;
				}
		  }
		  for(j=0;j<l-1;j++)   printf("%c",b[j]);
		  printf("%c\n",b[l-1]);
	}
	return 0;
}


int main(){
	int i, n, j;
	scanf("%d", &n);
	for (i=0;i<n;i++){
		 char zifu[MAX+1];
	     scanf("%s", &zifu);
	     for(j=0;zifu[j];j++){
			 if(zifu[j]=='A'){
				 zifu[j]='T';
			 }
			 else if(zifu[j]=='G'){
				 zifu[j]='C';
			 }
			 else if(zifu[j]=='C'){
				 zifu[j]='G';
			 }
			 else if(zifu[j]=='T'){
				 zifu[j]='A';
			 }
		 }
		 if(!(zifu[j])){
		 printf("%s\n", zifu);
		 }
	}
	return 0;
}


int main(){
	int n,i,j,l;
	char line[257];
	scanf("%d",&n);
	for(i=0;i<n-1;i++){
		scanf("%s",line);
		l=strlen(line);
		for(j=0;j<l;j++){
			if(line[j]=='A')
				line[j]='T';
			else if(line[j]=='T')
				line[j]='A';
			else if(line[j]=='G')
				line[j]='C';
			else if(line[j]=='C')
				line[j]='G';
		}
		printf("%s\n",line);
	}
	scanf("%s",line);
	l=strlen(line);
	for(j=0;j<l;j++){
		if(line[j]=='A')
			line[j]='T';
		else if(line[j]=='T')
			line[j]='A';
		else if(line[j]=='G')
			line[j]='C';
		else if(line[j]=='C')
			line[j]='G';
	}
	printf("%s",line);

	return 0;
}


int main(){
	int n,i,j,a;
	char num[4];
	gets(num);
	n=atoi(num);
	for(i=0;i<n;i++){
		char yl[256];
		char bl[256];
		gets(yl);
		a=strlen(yl);
		for(j=0;j<a;j++){
			if(yl[j]==65){
				bl[j]='T';
			}else if(yl[j]==67){
				bl[j]='G';
			}else if(yl[j]==71){
				bl[j]='C';
			}else{
				bl[j]='A';
			}
			printf("%c",bl[j]);
		}
		printf("\n");
	}
	return 0;
}


char com(char ch);
char com(char ch)
{
	if(ch=='A')
		return 'T';
	else if(ch=='T')
		return 'A';
	else if(ch=='G')
		return 'C';
	else if(ch=='C')
		return 'G';
}
int main(){
	int n,i,j;
	char chain[1000][256];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",chain[i]);
		for(j=0;j<strlen(chain[i]);j++)
			chain[i][j]=com(chain[i][j]);
	}
	for(i=0;i<n;i++)
		printf("%s\n",chain[i]);
	return 0;
}


void main()
{
	int n,l,i;char c[10];
	char str[256];
	scanf("%d",&n);gets(c);
	while(n--)
	{
		memset(str,0,sizeof(str));
		gets(str);
		l=strlen(str);
		for(i=0;i<l;i++)
		{
			switch(str[i])
			{
			case'A':printf("T");break;
			case'T':printf("A");break;
			case'C':printf("G");break;
			case'G':printf("C");break;
			}
		}
		printf("\n");
	}
}


int main(int argc, char* argv[])
{	int i,len,n;
	char str[256],str2[256];
	scanf("%d",&n);
	while(n>0)
	{
		scanf("%s",str);
		len=strlen(str);
		for(i=0;i<len;i++)
		{
			if(str[i]=='A')
				str2[i]='T';
			if(str[i]=='T')
				str2[i]='A';
			if(str[i]=='C')
				str2[i]='G';
			if(str[i]=='G')
				str2[i]='C';
		}
		str2[len]='\0';
		printf("%s\n",str2);

		n--;
	}

	return 0;
}


int main()
{
	char a[256];
	int n;
	cin>>n;
	getchar();
	for(int i=1;i<=n;i++)
	{
		cin.getline(a,256);
		int q;
		q=strlen(a);
		for(int m=0;m<q;m++)
		{
			if(a[m]=='A')
				cout<<"T";
			if(a[m]=='T')
				cout<<"A";
			if(a[m]=='G')
				cout<<"C";
			if(a[m]=='C')
				cout<<"G";
		}
		printf("\n");

	}
	return 0;
}


int main(){
  int n;
  char ml[300];
  scanf("%d",&n);
  int i;
  for(i=0;i<n;i++){
      scanf("%s",ml);
      int l=strlen(ml);
      for(int k=0;k<l;k++){
          if(ml[k]=='A'){ml[k]='T';}
          else if(ml[k]=='T'){ml[k]='A';}
          else if(ml[k]=='C'){ml[k]='G';}
          else if(ml[k]=='G'){ml[k]='C';}
      printf("%c",ml[k]);
      }
      printf("\n");
  }

    return 0;
}


int main(int argc, char* argv[])
{
	int n,len,i,j;
	char str[256],s;

	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",str);
		len=strlen(str);
		for(j=0;j<len;j++)
		{
			if(str[j]=='A')
				s='T';
			if(str[j]=='T')
				s='A';
			if(str[j]=='C')
				s='G';
			if(str[j]=='G')
				s='C';
			if(j<len-1)
				printf("%c",s);
			else
				printf("%c\n",s);
		}

	}
	return 0;
}


int main(int argc, char* argv[])
{
	int n;

	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		char a[255];

		scanf("%s",a);
		int len=strlen(a);

		for(int j=0;j<len;j++)
		{
			if(a[j]=='A')
			{
				a[j]=a[j]+19;
			}
			else if(a[j]=='T')
			{

				a[j]=a[j]-19;
			}
			else if (a[j]=='C')
			{
				a[j]=a[j]+4;
			}
            else if (a[j]=='G')
			{
				a[j]=a[j]-4;
			}

		}puts(a);

	}

	return 0;
}


int main()
{
	int i, j, n, oper=0;
	scanf("%d", &n);
	char s[257];
	gets(s);
	for(i=0; i<n; i++)
	{
		gets(s);
		for(j=0; j<strlen(s); j++)
		{
			switch(s[j])
			{
			case 'C':
				s[j] = 'G';
				break;
			case 'G':
				s[j] = 'C';
				break;
			case 'A':
				s[j] = 'T';
				break;
			case 'T':
				s[j] = 'A';
				break;
			}
		}
		if(oper)
			printf("\n");
		oper = 1;
		printf("%s", s);
	}
	return 0;
}


void main()
{
	int n,i,j;
	char *p;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		p=(char *)malloc(225*4);
		scanf("%s",p);
		for(j=0;*(p+j)!='\0';j++)
			switch(*(p+j))
		{
			case 'T':printf("%c",'A');break;
			case 'A':printf("%c",'T');break;
			case 'C':printf("%c",'G');break;
			case 'G':printf("%c",'C');break;
		}
		printf("\n");
		free(p);
	}
}


int main(){
    int n;
    scanf("%d",&n);
    char jianji[n][260],hubu[n][260];
    for(int i=0;i<n;i++){
        scanf("%s",jianji[i]);
        int len=strlen(jianji[i]);
        for(int k=0;k<len;k++){
            if(jianji[i][k]=='A'){
                hubu[i][k]='T';
            }
            else if(jianji[i][k]=='T'){
                hubu[i][k]='A';
            }
            else if(jianji[i][k]=='C'){
                hubu[i][k]='G';
            }
            else if(jianji[i][k]=='G'){
                hubu[i][k]='C';
            }
        }
        for(int k=len;k<n;k++){
            hubu[i][k]='\0';
        }
    }
    for(int i=0;i<n-1;i++){
        printf("%s\n",hubu[i]);
    }
    printf("%s",hubu[n-1]);
    return 0;
}


int main()
{
	int n,i,j;
	char jj1[256]={0},jj2[256]={0};
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",jj1);
		for(j=0;j<strlen(jj1);j++)
		{
			switch(jj1[j])
			{
			case 'A':
				jj2[j]='T';
				break;
			case 'T':
				jj2[j]='A';
				break;
			case 'C':
				jj2[j]='G';
				break;
			case 'G':
				jj2[j]='C';
				break;
			default:
				break;
			}
		}
		jj2[j] = '\0';
		printf("%s\n",jj2);
	}
	return 0;
}


int main()
{
    char a[255];
	int n,i,j;
	scanf("%d",&n);
	for(i=0;i<=n;i++)
	{
        if(i!=0)
			printf("\n");
	    scanf("%s",&a);
		for(j=0;j<strlen(a);j++)
		{
			if(a[j]=='A')
				printf("T");
			if(a[j]=='T')
				printf("A");
			if(a[j]=='C')
				printf("G");
			if(a[j]=='G')
				printf("C");
		}
		memset(a,0,sizeof(a));
	}
	return 0;
}


int main()
{
	int n;
	int i;
	char c;
	scanf("%d",&n);
	getchar();
	for(i=0;i<n;i++)
	{
		while(1)
		{
			scanf("%c",&c);
			if(c=='\n')
			{
			break;
			}
			else if(c=='A')
			{
				printf("T");
			}
			else if(c=='T')
			{
				printf("A");
			}
			else if(c=='G')
			{
				printf("C");
			}
			else if(c=='C')
			{
				printf("G");
			}
		}
        printf("\n");

	}

	return 0;
}


int main(){
    int n,i,j;
    char zfc[1000][1000];
    scanf("%d",&n);
    for(i=0;i<n;i++)
        scanf("%s",zfc[i]);
for(i=0;i<n;i++){
for(j=0;j<strlen(zfc[i]);j++){
            if(zfc[i][j]=='A'){
                printf("T");
            }
            else if(zfc[i][j]=='T'){
                printf("A");
            }
            else if(zfc[i][j]=='G'){
                printf("C");
            }
            else if(zfc[i][j]=='C'){
                printf("G");
            }

        }
printf("\n");

    }
    return 0;
}


int main(){
	int n,i;
	char base[256];
	scanf("%d",&n);
	while(n!=0){
		scanf("%s",base);
		for(i=0;base[i]!='\0';i++){
			if(base[i]=='A')base[i]='T';
			else if(base[i]=='T')base[i]='A';
			else if(base[i]=='C')base[i]='G';
			else if(base[i]=='G')base[i]='C';
		}
		n--;
		printf("%s\n",base);
	}
	return 0;
}


int main()
{
	char a[256],t;
	int i,j,n;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		scanf("%s",&a);
	for(j=0;j<strlen(a);j++)
		{

			switch(a[j])
			{
			case'A':
				t='T';
				break;
			case'T':
				t='A';
				break;
			case'C':
				t='G';
				break;
			case'G':
				t='C';
				break;
			}
			printf("%c",t);
		}
	printf("\n");
	}

	return 0;
}


int main(){
    int n,i,j,len;
    scanf("%d",&n);
    char jjd[n][LEN],pdl[n][LEN];
    for(i=0;i<n;i++){
         for (j=0;j<LEN;j++) pdl[i][j]='\0';
        scanf("%s",jjd[i]);
        len=strlen(jjd[i]);
        for(j=0;j<len;j++){
            if(jjd[i][j]=='A'){
                pdl[i][j]='T';}
            else {if(jjd[i][j]=='T'){
                pdl[i][j]='A';}
            else {
                if(jjd[i][j]=='G'){
                    pdl[i][j]='C';}
            else {
                if(jjd[i][j]=='C'){
                    pdl[i][j]='G';}
            }}}
        }
        printf("%s\n",pdl[i]);
    }

    return 0;
}


int main()
{
	int n,i;
	scanf("%d",&n);
	getchar();
	char base[256],*p;
	for(i=0;i<n;i++)
	{
		scanf("%s",&base);
		p=base;
		for(;p<=&base[strlen(base)-1];p++)
		{
			if(*p=='A')
			{
				printf("T");
			}else if(*p=='T')
			{
				printf("A");
			}else if(*p=='C')
			{
				printf("G");
			}else
			{
				printf("C");
			}
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n,i,j,m;
	char a[256];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",a);
		m=strlen(a);
		for(j=0;j<m;j++)
		{
			if(a[j]=='A')
				printf("T");
			if(a[j]=='T')
				printf("A");

			if(a[j]=='C')
				printf("G");

			if(a[j]=='G')
				printf("C");
		}
		printf("\n");
	}
	return 0;
}


int main(){
	int m,i,t,k;
	char dna[256];
	scanf("%d\n",&m);
	for(i=0;i<m;i++){
		scanf("%s",dna);
		t=strlen(dna);
		for(k=0;k<t;k++){
			if(dna[k]=='A'){dna[k]='T';}
			else if(dna[k]=='T'){dna[k]='A';}
			else if(dna[k]=='C'){dna[k]='G';}
			else if(dna[k]=='G'){dna[k]='C';}
	}
		for(k=0;k<t;k++){
			if(k==t-1){printf("%c\n",dna[k]);}
			else{printf("%c",dna[k]);}
		}
	}
	return 0;
}


int main( int argc, char* argv[] ){
	char str[max], c;
	int size = 0, i, j;

	scanf( "%d", &size );

	for ( i = 0; i < size; i++ ){
		scanf( "%s", str );
		c = str[0];
		j = 0;
		while ( c != '\0'){
			switch (c){
				case 'A':
					printf("T");
					break;
				case 'T':
					printf("A");
					break;
				case 'G':
					printf("C");
					break;
				case 'C':
					printf("G");
					break;
			}//switch
			j++;
			c = str[j];
		}//while
		printf("\n");
	}//for

	return 0;
}


int main()
{
 int q;
 char a[255];
 scanf("%d",&q);
 for(int i=0;i<=q-1;i++)
 {
   scanf("%s",a);
   for(int j=0;j<=strlen(a)-1;j++)
    {
        if(a[j]==65){printf("T");}
        else if(a[j]==84){printf("A");}
        else if(a[j]==71){printf("C");}
        else if(a[j]==67){printf("G");}
    }
  printf("\n");
  }
  int y;
  scanf("%d",&y);
    return 0;
    }


void main()
{
	int n,i,k,j;
	char word[1000],c;
	scanf("%d",&n);
c=getchar();
	for(i=0;i<n;i++)
	{
		gets(word);
		k=strlen(word);
		for(j=0;j<k;j++)
		{
			if(word[j]=='A')
				printf("T");
			if(word[j]=='T')
				printf("A");
			if(word[j]=='G')
				printf("C");
			if(word[j]=='C')
				printf("G");
		}
		if(j==k)
			printf("\n");
	}
}


int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		char line[256];
		scanf("%s",&line);
		for(int j=0;j<256;j++)
		{
			if(line[j]=='A')
			{
				printf("T");
			}
			else if(line[j]=='T')
			{
				printf("A");
			}
			else if(line[j]=='C')
			{
				printf("G");
			}
			else if(line[j]=='G')
			{
				printf("C");
			}
			else
			{
				printf("\n");
				break;
			}
		}
	}
	return 0;
}


int main()
{
	int i,j,n;
	char zfc[MAX+1];
	char a='A';
	char b='T';
	char c='C';
	char d='G';
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%s",zfc);

		for(j=0;zfc[j];j++){
			if(zfc[j]==a){
				zfc[j]=b;
				continue;}

			if(zfc[j]==b){
				zfc[j]=a;
				continue;}

			if(zfc[j]==c){
				zfc[j]=d;
				continue;}

			if(zfc[j]==d){
				zfc[j]=c;
				continue;}

		}
			printf("%s\n",zfc);
		}

	return 0;
}


char pd(char x);
int main(){
	int i,j,n,m;
	char dui;
	char jianji[256];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",jianji);
		m=strlen(jianji);
		for(j=0;j<m;j++){
			dui=pd(jianji[j]);
			printf("%c",dui);
		}
		if(i<n-1){
			printf("\n");
		}
	}
	return 0;
}

char pd(char x){
	char dy;
	if(x=='A'){
		dy='T';
	}
	if(x=='T'){
		dy='A';
	}
	if(x=='C'){
		dy='G';
	}
	if(x=='G'){
		dy='C';
	}
	return dy;
}


int main(int argc, char *argv[])
{ char jianji[1000][399];
 int n,i,j;
 char jianji1[1000][399];
 int m[1000];
 scanf("%d",&n);
 for(i=0;i<n;i++){
                  scanf("%s",jianji[i]);}
                  for(i=0;i<n;i++){
                                   m[i]=strlen(jianji[i]);
                                   for(j=0;j<m[i];j++){
                                                    if(jianji[i][j]=='A')
                                                    jianji1[i][j]='T';
                                                    else if(jianji[i][j]=='T')
                                                    jianji1[i][j]='A';
                                                    else if(jianji[i][j]=='G')
                                                    jianji1[i][j]='C';
                                                    else if(jianji[i][j]=='C')
                                                    jianji1[i][j]='G';}}
                  for(i=0;i<n;i++){
                                   for(j=0;j<m[i];j++)
                                   {printf("%c",jianji1[i][j]);}
                                   printf("\n");}

  return 0;
}


int main()
{
	int j,i,len,n;
	char a[256];
	char b[256];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
	    scanf("%s",a);
	    len=strlen(a);
	   for(i=0;i<len;i++)
	   {
		 switch(a[i])
		   {
		 case 'A':b[i]='T';
			break;
		 case 'T':b[i]='A';
			break;
		 case 'G':b[i]='C';
			break;
		 case 'C':b[i]='G';
			break;
		   }
	    }
	   for(i=0;i<len;i++)
	      printf("%c",b[i]);
	   printf("\n");
 	}

	return 0;
}


int main(int argc, char* argv[])
{
	char a[255],b[255];
	int n,i;
	int a1,j;
	scanf("%d",&n);
	for(i=0;i<n;i++){
        scanf("%s",a);
		a1=strlen(a);
		for(j=0;j<a1;j++){
			switch(a[j]){
			case 'A':b[j]='T';break;
			case 'T':b[j]='A';break;
			case 'C':b[j]='G';break;
			case 'G':b[j]='C';break;
			}
		    printf("%c",b[j]);
		}
		printf("\n");
	}

    return 0;
}


int main(){
    int n,i,k,l;
    scanf("%d",&n);
    char jj[256];
    for(i=0;i<n;i++){
        scanf("%s",jj);
        l=strlen(jj);
        for(k=0;k<l;k++){
            if(jj[k]=='A'){
                jj[k]='T';
                continue;
            }
            if(jj[k]=='T'){
                jj[k]='A';
                continue;
            }if(jj[k]=='C'){
                jj[k]='G';
                continue;
            }
            if(jj[k]=='G'){
                jj[k]='C';
                continue;
            }
        }
        printf("%s\n",jj);
    }

return 0;
}


int main()
{
	int n,i,j;
	char ys[1000],hc[1000];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",&ys);
		for(j=0;j<1000;j++)
		{
			if(ys[j]=='\0')
			{
				hc[j]='\0';
			}
			switch (ys[j])
			{
				case 'G':
				hc[j]='C';
				break;
				case 'C':
				hc[j]='G';
				break;
				case 'A':
				hc[j]='T';
				break;
				case 'T':
				hc[j]='A';
				break;
			}
		}
		puts(hc);
	}
	return 0;
}


int main(){
	int n;
	char DNA[1000][260];
	scanf("%d",&n);
	for(int j=0;j<n;j++){
		scanf("%s",&(DNA[j]));
	}
	int pd=0,m;
	for(int t=0;t<n;t++){
		pd=strlen(DNA[t]);
		for(m=0;m<pd-1;m++){
			if(DNA[t][m]=='A'){
				printf("T");
			}
			else if(DNA[t][m]=='T'){
				printf("A");
			}
			else if(DNA[t][m]=='C'){
				printf("G");
			}
			else if(DNA[t][m]=='G'){
				printf("C");
			}
		}
		if(DNA[t][pd-1]=='A'){
			printf("T\n");
		}
		else if(DNA[t][pd-1]=='T'){
			printf("A\n");
		}
		else if(DNA[t][pd-1]=='C'){
			printf("G\n");
		}
		else if(DNA[t][pd-1]=='G'){
			printf("C\n");
		}
	}
	return 0;
}


char b(char f);
int main(){
   char s[256];
   int i,j,n;
   scanf("%d",&n);
   for(j=0;j<n;j++) {
       scanf("%s",s);
       for(i=0;s[i];i++)
           s[i]=b(s[i]);
       printf("%s\n",s);
   }
return 0;
}
char b(char f){
   if(f=='A')return 'T';
   if(f=='T')return 'A';
   if(f=='C')return 'G';
   if(f=='G')return 'C';
}


int main()
{
	int n,i,j;
	char s[256];
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%s",s);
		int len=strlen(s);
		for(j=0;j<len;j++)
		{
			if(j!=len-1)
			{
				switch(s[j]){
				   case 'A':printf("%c",'T');break;
				   case 'T':printf("%c",'A');break;
				   case 'C':printf("%c",'G');break;
				   case 'G':printf("%c",'C');break;
				}
			}
			else
			{
				switch(s[j]){
				   case 'A':printf("%c\n",'T');break;
				   case 'T':printf("%c\n",'A');break;
				   case 'C':printf("%c\n",'G');break;
				   case 'G':printf("%c\n",'C');break;
				}
			}
		}
	}
	return 0;
}


int main()
{
	int n,i,j;
	char a[256];
	scanf("%d",&n);
	scanf("%c",&a[0]);
	for(i=0;i<n;i++)
	{
		j=0;
		while(j<=255)
		{
			scanf("%c",&a[j]);
			if(a[j]=='A') printf("T");
			else if(a[j]=='T') printf("A");
			else if(a[j]=='C') printf("G");
			else if(a[j]=='G') printf("C");
			else break;
			j=j+1;
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n,a,b,len;
	char z[300];
	scanf("%d",&n);
	for(a=0;a<=n-1;a++)
	{
		scanf("%s",z);
		len=strlen(z);
		for(b=0;b<=len-1;b++)
		{
			if(z[b]=='A')
			{
				z[b]='T';
				continue;
			}
            if(z[b]=='T')
			{
				z[b]='A';
				continue;
			}
			if(z[b]=='G')
			{
				z[b]='C';
				continue;
			}
			if(z[b]=='C')
			{
				z[b]='G';
				continue;
			}
		}
		printf("%s\n",z);
	}
	return 0;
}


char anti_base(char base){
	char anti;
	    if(base == 'A')
			anti = 'T';
		if(base == 'T')
			anti = 'A';
		if(base == 'G')
		    anti = 'C';
	    if(base == 'C')
			anti = 'G';
		return anti;
}
int main (){
	int n,i,j;
	scanf ("%d",&n);
	char sequence[n][300],a;
	for (i = 0; i < n; i ++){
		scanf("%s",sequence[i]);
	}
	for (i = 0;i < n;i ++){
	for (j = 0;;j ++){
		if(sequence[i][j] != 0 ){
	     	a = anti_base(sequence[i][j]);
	    	printf("%c",a);
		}
		else
			break;
	}
	 printf("\n");
	}

}


int main()
{
	int n;
	scanf("%d",&n);
	char zfc[1000][1000];
	int i,j;
	int len;
	for (i=0;i<n;i++)
	{
		scanf("%s",zfc[i]);
		len=(strlen)(zfc[i]);
		for (j=0;j<len;j++)
		{
			if (zfc[i][j]==65)
			{
				zfc[i][j]=84;
				continue;
			}
			if (zfc[i][j]==84)
			{
				zfc[i][j]=65;
				continue;
			}
			if (zfc[i][j]==67)
			{
				zfc[i][j]=71;
				continue;
			}
			if (zfc[i][j]==71)
			{
				zfc[i][j]=67;
				continue;
			}

		}
		printf("%s\n",zfc[i]);
	}

	return 0;
}


int main(){
	char a[100],b[300],c[300];
	gets(a);
	int n=atoi(a),i,k;
	int s;
	for(i=0;i<n;i++){
		gets(b);
		s=strlen(b);
		for(k=0;b[k]!='\0';k++){
			switch (b[k]){
			case 'A':c[k]='T';break;
			case 'T':c[k]='A';break;
			case 'C':c[k]='G';break;
			case 'G':c[k]='C';break;
			}
		}
		c[s]='\0';
		puts(c);
	}

	return 0;
}


int main(){
    char s[256];
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%s",s);
        for(int j=0;j<strlen(s);j++){
            switch(s[j]){
                case'A':s[j]='T';
                break;
                case'T':s[j]='A';
                break;
                case'G':s[j]='C';
                break;
                case'C':s[j]='G';
                break;
            }
        }printf("%s\n",s);
    }
    return 0;
}


void dna()

{

     int i;

     char str[255];

     gets(str);

     for(i=0;i<strlen(str);i++)

       {

       if(str[i]=='A')

         str[i]='T';

       else if(str[i]=='T')

         str[i]='A';

       else if(str[i]=='C')

         str[i]='G';

       else if(str[i]=='G')

         str[i]='C';

       }

     puts(str);

}

main()

{

      int a,i;

      scanf("%d",&a);

      getchar();

      for(i=0;i<a;i++)

        dna();

}


char hb(char a){
	if(a=='A'){
		a='T';
	}else if(a=='T'){
		a='A';
	}else if(a=='C'){
		a='G';
	}else if(a=='G'){
		a='C';
	}
	return a;
}

int main(){
	int n;
	scanf("%d",&n);
	for(int z=0;z<n;z++){
		char s[256]={'\0'};
		scanf("%s",s);
		int length;
		length=strlen(s);
		for(int i=0;i<length;i++){
			s[i]=hb(s[i]);
		}
		printf("%s\n",s);
	}
	return 0;
}


char swap(char x){
	char y;
	if(x=='A')
		y='T';
	if(x=='T')
		y='A';
	if(x=='G')
		y='C';
	if(x=='C')
		y='G';
	return y;
}
int main(){
	int n,i,j,len;
	char str[50000];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",str);
		len=strlen(str);
		for(j=0;j<len;j++){
			str[j]=swap(str[j]);
		}
		printf("%s\n",str);
	}
	return 0;
}


int main()
{
	int n,i,j;
	char a;
	scanf("%d",&n);
    scanf("%c",&a);
	for(i=0;i<n;i++)
	{

		for(j=0;j<260;j++)
		{

			scanf("%c",&a);
			if(a=='\n')
			{
				printf("\n");
				break;
			}
			else if(a=='A')
			{
				printf("T");
			}
			else if(a=='T')
			{
				printf("A");
			}
            else if(a=='G')
			{
				printf("C");
			}
            else if(a=='C')
			{
				printf("G");
			}
		}
	}
	return 0;
}


char convert[100];

int main(){
    int N,l,i,tt;
    char a[10000];

    convert['A'] = 'T';
    convert['T'] = 'A';
    convert['G'] = 'C';
    convert['C'] = 'G';

    scanf("%d",&N);
    for (tt = 1; tt <=N; tt++){
          scanf("%s",a);
          l = strlen(a);
          for (i=0;i<l;i++) printf("%c",convert[a[i]]);
          printf("\n");
    }

    return 0;
}


int main(int argc, char* argv[])
{
	int n,i,j;
	char d[300];
	scanf("%d\n",&n);
	for(i=1;i<=n;i++)
	{
		for(j=0;j<=256;j++)
		{
			d[j]=0;
		}
		gets(d);
		j=0;
		while (d[j]!=0)
		{
			switch (d[j])
			{
			case 'A':
					printf("T");
					break;
			case 'T':
					printf("A");
					break;
			case 'C':
					printf("G");
					break;
			case 'G':
					printf("C");
					break;
			}
			j++;
		}
		printf("\n");
	}
	return 0;
}


int main()
{
	int n;

	scanf("%d",&n);
	scanf("\n");

	while(n--)
	{
		char str[256];
		char pair[256];
		gets(str);
		int i;

		for(i=0;i<strlen(str);i++)
		{
			switch(str[i])
			{
			case 'A':
				pair[i]='T';
				break;
			case 'T':
				pair[i]='A';
				break;
			case 'G':
				pair[i]='C';
				break;
			case 'C':
				pair[i]='G';
				break;
			}
		}
		pair[i]='\0';
		puts(pair);
	}

	return 0;
}


int main(){
	char s[1000];
	int n;
	scanf("%d", &n);
	for(int i=1; i<=n; i++){
		scanf("%s", &s);
		for(int j=0; j<strlen(s); j++){
			if(j<strlen(s)-1&&s[j]=='A')
				printf("T");
			if(j<strlen(s)-1&&s[j]=='T')
				printf("A");
			if(j<strlen(s)-1&&s[j]=='G')
				printf("C");
			if(j<strlen(s)-1&&s[j]=='C')
				printf("G");
			if(j==strlen(s)-1){
				if(s[j]=='A')
					printf("T\n");
				if(s[j]=='T')
					printf("A\n");
				if(s[j]=='G')
					printf("C\n");
				if(s[j]=='C')
					printf("G\n");
			}
		}
	}
	return 0;
}


void complement(char chain[])
{
	int j;
	for(j=0;j<strlen(chain);j++){
		if(chain[j]=='A'){
			chain[j]='T';
		}else if(chain[j]=='T'){
			chain[j]='A';
		}else if(chain[j]=='C'){
			chain[j]='G';
		}else if(chain[j]=='G'){
			chain[j]='C';
		}
	}
}

int main()
{
	int n;
	char chain[256];
	int i,j;

	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s",chain);
		complement(chain);
		printf("%s\n",chain);
	}

	return 0;
}


int main(){
 int n,i,j;
 scanf("%d",&n);
 scanf("\n");
 char str[256];
 for(i=0;i<n;i++){
  scanf("%s",str);
  for(j=0;str[j];j++){
   if(str[j]=='A'){
    printf("T");
   }else if(str[j]=='T'){
   printf("A");
   }else if(str[j]=='C'){
   printf("G");
   }else if(str[j]=='G'){
   printf("C");
   }
  }
  printf("\n");
}
  return 0;
 }


int main()
{
	int n,i,j;
	char a[255];
	 int len;

	scanf("%d",&n);

	for(i=0;i<n;i++)
	{
		scanf("%s",&a);
		len=strlen(a);
		for(j=0;j<len-1;j++)
		{
			if(a[j]=='A')
			{
                printf("T");
			}
			else if(a[j]=='T')
			{
				printf("A");
			}
			else if(a[j]=='C')
			{
				printf("G");
			}

			else if(a[j]=='G')
			{
				printf("C");
			}
		}

		if(a[len-1]=='A')
			{
                printf("T\n");
			}
		else if(a[len-1]=='T')
			{
				printf("A\n");
			}
		else if(a[len-1]=='C')
			{
				printf("G\n");
			}
		else if(a[len-1]=='G')
			{
				printf("C\n");
		}
	}

	return 0;

	}


int main()
{
	int n,i;
	char z;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("\n");
		do
		{
			scanf("%c",&z);
			if(z=='A')
				printf("T");
			else if(z=='T')
				printf("A");
			else if(z=='C')
				printf("G");
			else if(z=='G')
				printf("C");
		}while(z!='\n');
		printf("\n");
	}
	return 0;
}


int main()
{
    char zfc[N][N];
	int n;
	int cd[N];
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++)
	{
		scanf("%s",zfc[i]);
		cd[i]=strlen(zfc[i]);
	}
	int j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<cd[i];j++)
		{
		switch(zfc[i][j])
			{
				case'A':
					printf("%c",'T');
					break;
				case'T':
                    printf("%c",'A');
					break;
				case'C':
 					printf("%c",'G');
					break;
				case'G':
                    printf("%c",'C');
					break;
			}
			if(j==cd[i]-1)
			{
				printf("\n");
				break;
			}
		}
	}
	return 0;
}


int main(){
	int a[256] , i , n  ;
	char ch;
	a['A']='T';
	a['T']='A';
	a['G']='C';
	a['C']='G';
	scanf("%d\n", &n );

	while(n--){
		ch=getchar();
		while(ch!='\n') {
			putchar(a[ch]);
			ch=getchar();
		}
		putchar('\n');
	}
	return 0;
}


int main()
{
    int i,j,n,m;
    char a[256],*pc;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        scanf("%s",a);
        m=strlen(a);
        pc=a;
        for(j=0;j<=m-1;j++)
        {
            switch(*(pc+j))
            {
                case 'A':  *(pc+j)='T';break;
                case 'T':  *(pc+j)='A';break;
                case 'C':  *(pc+j)='G';break;
                case 'G':  *(pc+j)='C';break;
            }
        }
        puts(a);
    }
    return 0;
}