int main()
{
	int n,i,m,p,j;
	scanf("%d",&n);
	for(i=3;i<=n/2;i+=2)
	{
		for(j=3;(double)j<=sqrt((double)i);j+=2)
		{
			if(i%j==0)
				break;
		}
		if((double)j>sqrt((double)i))
		{
			m=n-i;
			for(p=3;(double)p<sqrt((double)m);p+=2)
			{
				if(m%p==0)
					break;
			}
			if((double)p>sqrt((double)m))
				printf("%d %d\n",i,m);
		}
	}
	return 0;
}


int main()
{
  int m,i,j,k;
  scanf("%d",&m);
  for(i=3;i<=m/2;i++)
{
  for(j=2;j<i;j++)
  if(i%j==0) break;

  if(j<i) continue;
    for(k=2;k<m-i;k++)

        if((m-i)%k==0) break;

  if(k<(m-i)) continue;
  printf("%d %d\n",i,m-i);
}
  return 0;
}


void main()
{
	int n,i,k;
	int issu(int k);
	scanf("%d",&n);
	for(i=2;i<=n/2;i++)
	{
		if(issu(i))
		{
			if(issu(n-i))
				printf("%d %d\n",i,n-i);
		}
	}
}

int issu(int k)
{
	int j,s;
	s=1;
	for(j=2;j<k;j++)
	{
		if(k%j==0)
		{
			s=0;
			return(s);
			break;
		}

	}
}


int main()
{
	int m,j,w,e;
	scanf("%d",&m);
	int judge(int a);
	for(j=2;j<=m/2;j++)
	{
		w=judge(j);
		e=judge(m-j);
		if(w==1&&e==1)
			printf("%d %d\n",j,m-j);
	}

	return 0;
}
int judge(int a)
{
	int i,flag=1;
	for(i=2;i*i<=a;i++)
	{
		if(a%i==0)
			{flag=0;
		break;}
	}
	return flag;
}


int main(){
    int m,i=2,j=2,a,b,n,k,l;
    scanf("%d",&m);
    n=m/2;
    while(i<=n){
                k=2;
                l=2;
                while(k<=i){
                            if(i%k==0)
                            break;
                            else
                            k++;}
                if(k==i){
                         j=m-i;
                         while(l<=j){
                                     if(j%l==0)
                                     break;
                                     else
                                     l++;}
                         if(l==j)
                         printf("%d %d\n",i,j);
                         i++;
                         }
                else{
                     i++;
                     continue;
                     }
                }
    return 0;
}


int main(){
	int e;
	cin>>e;
	int a = 3,b;
	while(a <= e/2){

	int t = 3;
	while(t < a){
		int m = a%t;
		if(m == 0)break;
		t+=2;
	}
	int q = 3;
	while(q < e - a){
		int n = (e-a)%q;
		if(n == 0)break;
		q+=2;
	}
	if(t == a && q == e-a)
		cout<<a<<" "<<e-a<<endl;
	a += 2;
	}
	return 0;
}


int f(int a)
{
    int i=2,m;
    m=sqrt(a);
    for(i=2;i<=m;i++)
    {
        if(a%i==0)break;
    }
    if(i>=m+1)return a;
    else return 0;
}
int main()
{
    int m;
    scanf("%d",&m);
    int i,p,q;
    for(i=3;i<=m/2;i=i+2)
    {
        p=f(i);q=f(m-i);
        if(p!=0&&q!=0)printf("%d %d\n",p,q);
    }

}


int sushu(int n)
{
	int i;
	int flag=1;
	for(i=2;i<n;i++)
	{
		if(n%i==0)
		{
			flag=0;
			break;
		}
	}
	return flag;
}

int main()
{
	int m,i;
	scanf("%d",&m);
    for(i=3;i<=m/2;i=i+2)
	{
		if(sushu(i)&&sushu(m-i))
		{
			printf("%d %d\n",i,m-i);
		}
	}
	return 0;
}


int p( int n)
{int i;
if(n==3)
return 1;
else
{    for(i=2;i<n;i++)
    {if(n%i==0)
{return 0;

    }
    if(i==n-1)
    {return 1;}
                    }}
                    }
int main()
{int m,j;
cin>>m;
for(j=3;j<=(m/2);j++)
{if(p(j)==1)
{if(p(m-j)==1)
cout<<j<<" "<<m-j<<endl;
         }
         }
    return 0;
    }


int su(int z)
  {
       int i=2,t=0,k=sqrt(z);
       for(i=2;i<=k;i++)
        {
          if(z%i==0)
          break;
        }
        if(i>k)  t=1;
        return t;
}
int main()
{
    int m,i,j;
    scanf("%d",&m);
          for(i=3;i<=m/2;i++)
           {  j=m-i;
             if(su(i)&&su(j))
             {printf("%d %d\n",i,j);
             }
		  }
      return 0;
}


int main()
{
	int prime(int);
	int n,i;
	scanf("%d",&n);
	for(i=2;i<=n/2;i++)
		if(prime(i)&&prime(n-i))
			printf("%d %d\n",i,n-i);

}

int prime(int n)
{
	int i,a=1;
	for(i=2;i<=sqrt(n)&&a==1;i++)
		if(n%i==0)
			a=0;
	return(a);
}


int prime(int n)
{
	int i,flag = 0;
	if(n%2)
	{
		for(i = 3;i <= sqrt((double)n); i+=2)
		{
			if(n%i==0){
				flag = 1;
				break;
			}
		}
		if(flag)return 0;
		else return 1;
	}
	else return 0;
}

int main()
{
	int n,i;
	cin>>n;
	for(i = 3;i <= n/2;i+=2)
	{
		if(prime(i)&&prime(n-i))
			cout<<i<<' '<<n-i<<endl;
	}
	return 0;
}


int sushu(int a)
{
          int i,b;
          b=(int)sqrt(a);
          for(i=2;i<=b;i++)
          {
                           if(a%i==0)
                           break;
          }
          if(i==b+1)
            return 1;
          else
            return 0;
}
main()
{
    int m,i;
    scanf("%d",&m);
    for(i=3;i<=m/2;i++)
    {
        if(sushu(i)==1&&sushu(m-i)==1)
        {
                                      printf("%d %d\n",i,(m-i));
        }
    }
    getchar();
    getchar();
}


int is(int x)
{
    int i,res=1;
    if(x%2==0)res=0;
    for(i=3;i<=x/2;i++)
    {
        if(x%i==0)
        {
            res=0;
            break;
        }
    }
    return res;
}
int main()
{
    int i=3,input;
    scanf("%d",&input);
    while(i<=input/2)
    {
        if(is(i)==0||is(input-i)==0);
        else printf("%d %d\n",i,input-i);
        i++;
    }

}


void main()
{
  int i,j,m,a,b;
  scanf("%d",&m);
  for(i=3;i<=m/2;i++)
{
  j=m-i;
  for(a=2;a<=sqrt(i);a=a+1)
{
 if(i%a==0) break;
}
  for(b=2;b<=sqrt(j);b=b+1)
{
 if(j%b==0) break;
}
if(a>sqrt(i)&&b>sqrt(j)) printf("%d %d\n",i,j);
}
}


main()
{
      int m;
      scanf("%d",&m);
      int i,j,judge,k,judge2;
      for (i=2;i<=m/2;i++)
      {
          judge=1;
          for (j=2;j<i/2;j++)
          {
              if (i%j==0)
                 judge=0;
          }
          if (judge==1)
          {
              k=m-i;
              judge2=1;
              for (j=2;j<k/2+1;j++)
              {
              if (k%j==0)
                 judge2=0;
              }
              if (judge2==1)
              printf("%d %d\n",i,k);
          }
      }
      getchar();
      getchar();
}


int main()
{
	int m, primeA, primeB;
	int i, k;
	cin >> m;
	if (m >= 6 && m <=10000 && m % 2 == 0)
	{//if
	for (primeA = 3; primeA <= m - 1; primeA +=2)
	{
		primeB = m - primeA;
		if (primeA <= primeB)
		{
			for (i = 3; i <= (int)sqrt(m); i++)
			{
				if (primeA % i == 0 && primeA != i)
				{
					break;
				}
			}
			if (i == (int)sqrt(m) + 1)
			{
				for (k = 3; k <= (int)sqrt(m); k++)
				{
					if (primeB % k == 0 && primeB != k)
					{
						break;
					}
				}
			if (k == (int)sqrt(m) + 1)
				cout << primeA << " " << primeB << endl;
			}
		}
	}
	}//if
	return 0;
}


int zhishu(int n)
{
    int m,d,i;
m=(int)sqrt(n);
for(i=2;i<=m;i++)
{ if(n%i==0)
   break;}
if(i==m+1)
   d=1;
   else
   d=0;
   return(d);
}
main()
{
      int p,m;
      scanf("%d",&m);
      for(p=3;p<=m/2;p++)
      {if((zhishu(p)==1)&&(zhishu(m-p)==1))
      printf("%d %d\n",p,m-p);}
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();
      }


int prime(int k)
{
int p=(int)sqrt(k);
int t;
for (t=3;t<=p;t+=2)
if (k%t==0) break;
if (t>p) return 1; else return 0;
}
main()
{
int n;
scanf("%d",&n);
if (n<=200000)
{
for (int i=3;i<=n/2;i+=2)
if (prime(i))
{
if (prime(n-i))
printf("%d %d\n",i,n-i);
}}
else printf("%d",n);
}


int main(){
	int m,j,i,p;
	cin>>m;
	for(i=3;i<=m/2;i+=2)
	{
		p=0;
		for(j=2;j<=sqrt(i);j++)if(i%j==0){p=1;break;}
		for(j=2;j<=sqrt(m-i);j++)if((m-i)%j==0){p=1;break;}
		if(p==1)continue;
		else cout<<i<<" "<<m-i<<endl;
	}
	return 0;
}


inline int single(int);
int main()
{
	int m,a1,a2;
	cin>>m;
	for(a1=2;a1<=m/2;a1++)
	{
		if(single(a1)==2)
	{
			a2=m-a1;
			if(single(a2)==2)
			cout<<a1<<' '<<a2<<endl;
		}
	}
  return 0;
}
inline int single(int x)
{
	int n=0;int j;
	for (j=1;j<=x;j++)
	{
		if (x%j==0)
		n=n+1;
	}
	return n;
}


int sushu(int t)
{
	int r,cnt=0;
	r=(int)sqrt(t);
	for(int i=1;i<=r;i++)
	{
		if(t%i==0)
			cnt++;
	}
	if(cnt==1)
	{
		return t;
		cnt=0;
	}
	else
	{
		return 0;
		cnt=0;
	}
}
int main()
{
	int m,i,j;
	scanf("%d",&m);
	for(i=3;i<=(int)(m/2);i=i+2)
	{
        j=m-i;
		if(sushu(i)==i&&sushu(j)==j)
			printf("%d %d\n",i,j);
	}
	getchar();
	getchar();
}


int sushu(int n)
{
	int s=1,i;
	for(i=3;i<=sqrt(n);i+=2)
	{
		if(n%i==0)
			s=0;
	}
	return s;
}

void main()
{
	int i,j,m;
	scanf("%d",&m);
	for(i=3;i<=m/2;i+=2)
	{
		if (sushu(i)==1 && sushu(m-i)==1)
		{
			printf("%d %d\n",i,m-i);
		}
	}
}


int main()
{
	int m,a,b,c,d,e,f;
	scanf("%d",&m);
a=3;

	while((2*a)<=m)
{
b=m-a;
c=sqrt(a);
d=sqrt(b);
e=c;
f=d;

		while(e>=2)
{
if(a%e==0)
break;
else
e--;
		}
			while(f>=2)
{
if(b%f==0)
break;
else
f--;
			}
			if(e==1&&f==1)
				printf("%d %d\n",a,b);
			a++;

	}
return(0);
}


int a[5000];
int main()
{
	int sushu(int y);
	int x,i;
	scanf("%d",&x);
	for(i=0;i<x/2;i++)
	{
		a[i]=i+1;
	}
	for(i=2;i<x/2;i++)
	{
		if(sushu(a[i])&&sushu(x-a[i]))
				printf("%d %d\n",a[i],x-a[i]);
	}
	return 0;
}
int sushu(int y)
{
	int i;
	for(i=2;i<y/2+2;i++)
	{
		if(y%i==0)
			break;
	}
	if(i<y/2+1)
		return 0;
	else
		return 1;
}


int main()
{
	int a,i,j,k,m;
	i=3;
	scanf("%d",&a);
	while(i<=a/2)
	{
		k=3;
		while(k<i)
		{
			if(i%k==0)break;
			k=k+2;
		}
		if(k==i)
		{
			j=a-i;
			m=3;
			while(m<j)
			{
				if(j%m==0)break;
				m=m+2;
			}
			if(m==j) printf("%d %d\n",i,j);
		}
		i=i+2;
	}
	return 0;
}


int check(int);
int main()
{
	int n,i,j;
	cin >> n;
	for(i = 2; i < n; i++)
	{
		if((i % 2 != 0)&&(check(i)))
		{
			for(j = i; j < n; j++)
			{
				if((j % 2 != 0)&&(check(j)))
					if(i + j == n)
						cout << i << " " << j << endl;
			}
		}
	}
	return 0;
}
int check(int m)
{
	if(m == 2)
		return 1;
	int i,j;
	j = sqrt(m);
	for(i = 2; i <= j; i++)
	{
		if(m % i == 0)
			break;
	}
	if(i == j + 1)
		return 1;
	else
		return 0;
}


int main()
{
	int find(int n);
	int m,k;
	cin>>m;
	for(k=3;k<=(m/2);k=k+2)
	{
		if(k==find(k)&&(m-k)==find(m-k))
			cout<<k<<" "<<m-k<<endl;
	}
	return 0;
}
int find(int n)
{
	int i,c=0;
	for(i=1;i<=n;i++)
	{
		if(n%i==0) c=c+1;
	}
	if(c==2) return (n);
	else return 0;
}


int zhishu(int x)
{
	int i,z=1;
	for(i=2;i<=x/2;i++)
		if(x%i==0)
		{
			z=0;
			break;
		}
	return(z);
}
void main()
{
         int m,i;
         scanf("%d",&m);
         for(i=2;i<=m/2;i++)
         if(zhishu(i)&&zhishu(m-i))
         printf("%d %d\n",i,m-i);
}


int main()
{
	int a,i,j,n,m;
	scanf("%d",&a);
	for(i=3;i<a/2+1;i=i+2)
	{
		j=a-i;
			for(n=3;n<i;n=n+2)
			{
				if(i%n==0)
				{
					goto loop;
				}
			}
			for(m=3;m<j;m=m+2)
			{
				if(j%m==0)
				{
					goto loop;
				}
			}
			printf("%d %d\n",i,j);
	loop: continue;
	}
	return 0;
}


int main()
{
	int su(int x);
	int n,i;
	scanf("%d\n",&n);
	for(i=3;i<=n/2;i+=2)
	{
		if(su(i)&&su(n-i))
		{
			printf("%d %d\n",i,n-i);
		}
	}
}

int su(int x)
{
	int t,k,leap=1;
	if(x==3)
	  return 1;
	else
	{
		for(t=3;t<=(x/2);t+=2)
		{
			k=x%t;
			if(k==0)
			{
				leap=0;
				break;
			}
		}
	}
	return(leap);
}


int main()
{
    int su(int x);
	int n,i,j;
	scanf("%d",&n);
	for(i=3;i<=n/2;i+=2)
	{
		j=n-i;
		if(su(i)&&su(j))printf("%d %d\n",i,j);
	}
}
int su(int x)
{
	int i,z=1;
	if(x==2)z=1;
	else
	{
		for(i=2;i<=sqrt(x);i++)
		{
			if(x%i==0)
			{
				z=0;
				break;
			}
		}
	}
	return z;
}


int judge(int n)
{
	int limit;
	int count = 0;

	limit = sqrt(n);

	for(int i = 2; i <= limit; i ++)
	{
		if(n % i == 0)
		count = 1;
	}

	if(count == 0)
	return 1;

	return 0;
}

int main ()
{
	int m;

	cin >> m;

	for(int i = 3; i <= m / 2; i += 2)
	{
		if(judge(i) == 1 && judge(m - i) == 1)
		cout << i << " " << m - i << endl;
	}

	return 0;

}


int zhishu(int n)
{
    int i,m;
    for(i=2;i<n;i++)
    {
       if (n%i==0)
        {m=0;
        break;}
    }
    if (i==n)
     m=1;
     return m;
}
int main()
{
    int n,a,b;
    scanf("%d",&n);
    for(int i=3;i<=n/2;i++)
    {
            a=zhishu(i);
            b=zhishu(n-i);
            if (a==1&&b==1)
             printf("%d %d\n",i,n-i);
    }
    getchar();
    getchar();
    getchar();
    getchar();
}


int isprime(int n)
{
	int i;
	for(i=2;i*i<=n;i++)
		if(n%i==0)
			return 0;
	return 1;
}

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

	scanf("%d",&m);

	for(j=3;j*2<=m;j+=2)
		if(isprime(j)&&isprime(m-j))
			printf("%d %d\n",j,(m-j));

	return 0;
}


int panduan (int n);
int main()
{
	int m,i,t=0;
	cin>>m;
	for (i=3;i*2<=m;i++)
	{
		t=0;
		if (i%2!=0&&(m-i)%2!=0)
		{
			t=panduan(i)+panduan(m-i);
			if (t==2)
				cout<<i<<" "<<m-i<<endl;
		}
	}
	return 0;
}

int panduan (int n)
{
	int j;
	for (j=2;j*j<=n;j++)
	{
		if (n%j==0)
			break;
	}
	if (j*j>n)
		return 1;
	else
		return 0;
}


int main()
{
	int m, i, j, a, b;
	cin >> m;
	a = 3;
	b = m - 3;
	do
	{
		for ( i = 2; i < a; i ++ )
			if ( a % i == 0 )
				break;
		for ( j = 2; j < b; j ++)
			if ( b % j == 0)
				break;
		if(i==a && j==b)	cout<<a<<" "<<b<<endl;
    	a = a + 1;
		b = m - a;
	}while( a <= b );
	return 0;
}


int main()
{
	int check(int x);
	int a,b,num;
	scanf("%d",&num);
	for(a=2;a<=(num/2);a++)
	{
		b=num-a;
		if(check(b)&&check(a)) printf("%d %d\n",a,b);
	}
	return 0;
}
int check(int x){
	int i,k;
	k=sqrt(x);
	for(i=2;i<=k;i++)
	if(!(x%i)){
		x=0;break;}
	return x;
	}


int isprime(int n)
{
 int i;
for(i=2;i<n;i++)
if(n%i==0)
return 0;
return 1;
}

int main(void)
{
int m;
int i;
scanf("%d",&m);

for(i=3;i<=m/2;i+=2)
{
if(isprime(i)&&isprime(m-i))
{
printf("%d %d\n",i,m-i);
continue;
}
}
return 0;
}


int p(int n)
{
for(int i=2;i*i<=n;i++)
   if (n%i==0) return 0;
   return 1;
    }
int main()
{
    int a,p(int n);
    scanf("%d",&a);
    for (int i=3;2*i<=a;i++)
     if (p(i)*p(a-i)!=0) printf("%d %d\n",i,a-i);
    }


int is_prime(int n)
{
	int k,limit;
	if(n == 2)
		return 1;

	if(n % 2 == 0)
		return 0;

	limit = n/2;
	for(k=3; k <= limit; k+=2)
		if(n % k == 0)
			return 0;
		return 1;
}
int main ()
{
	int number,a,b,i;
	cin >>number;
	for (a=3;a<=number/2;a++)
	{
		b=number-a;
		if (is_prime(a)==1&&is_prime(b)==1) cout <<a<<" "<<b<<endl;
	}
	return 0;
}


int main()
{
    int n,i,j,k;
    scanf("%d",&n);
    for(i=3;i<=n/2;i++)
    {
        for(j=2;j<i;j++)
            if(i%j==0) break;
        for(k=2;k<n-i;k++)
            if((n-i)%k==0) break;
        if(j==i && k==n-i)
           printf("%d %d\n",i,n-i);
    }
    getchar();
    getchar();
}


void main()
{
     int i,j,m,n;
     int prime(int n);
     scanf("%d",&m);
     for(i=3;i<=m/2;i++)
     {  if(prime(i)&&prime(m-i))
           printf("%d %d\n",i,m-i);}
     }

     int prime(int n)
     {
         int k,i;
         k=sqrt(n);
         for(i=2;i<=k;i++) if(n%i==0)break;
         return(i>k)?1:0;
         }


int main()
{
	int m,a,b,i,j,i_limit_a,j_limit_b,bool_a,bool_b;
	scanf("%d",&m);
	for (a=3;a<=(m/2);a=a+2)
	{
		i_limit_a=sqrt(a);
		bool_a=1;
		for (i=3;i<=i_limit_a;i=i+2)
			if (a%i==0) {bool_a=0;break;}
	    if (bool_a)
		{
			b=m-a;
			bool_b=1;
            j_limit_b=sqrt(b);
			for (j=3;j<=j_limit_b;j=j+2)
				if (b%j==0) {bool_b=0;break;}
            if (bool_b) printf("%d %d\n",a,b);
		}
	}
	return 0;
}


int sushu(int a){
int flag=1;
int m,i;
m=sqrt(a);
for(i=2;i<=m;i++){
if(a%i==0) flag=0;}
return flag;}

int main()
{
	int m,x,y,k,i;
	scanf("%d",&m);

	for(k=3;k<=m/2;k+=2){
		if(sushu(k)&&sushu(m-k)) printf("%d %d\n",k,m-k);}

	return 0;
}


int ss(int x)
{
  double m;
  int i,f=0;
  m=sqrt(x);
  if(x%2==0) return 0;
  for(i=3;i<=m;i++)
    {
      if(x%i==0)
       {
         f=1;
         break;
       }
    }
  if(f==1) return 0;
  else return 1;
}
int main()
{
  int n,l,f,m;
  double k;
  int i,j,p;
  scanf("%d",&p);
    l=p/2;
    for(i=3;i<=l;i+=2)
       if(ss(i)&&ss(p-i))
       printf("%d %d\n",i,p-i);
    return 0;
}


int prime(int n)
{
	int i,product=1;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
			product=0;
	}
	return(product);
}
int main()
{
	int N,j,check;
	cin>>N;
	for(j=3;j<=N/2;j++)
	{
		check=prime(j)*prime(N-j);
		if (check>0)
		{
			cout<<j<<' '<<N-j<<endl;
		}
	}
	return 0;
}


int sushu(double a)
{
	int i,n,s;
	if((int) a%2==0)
	{
		return 0;
	}
	s=sqrt(a);
	for(i=3;i<=s;i+=2)
	{
		if((int)a%i==0)
			return 0;
	}
	return 1;
}
int main()
{
	int m,i,n;
	scanf("%d",&m);
	for(i=3;i<=m/2;i++)
	{
		if(sushu((double) i)&&sushu((double) m-i))
		{
			printf("%d %d\n", i,m-i);
		}
	}
}


int main()
{
	int m,i,p,k;
	int judge(int af);
	cin>>m;
	for(i=3;i<=m/2;i+=2)
	{
		p=judge(i);
		k=judge(m-i);
		if(p!=1&&k!=1)
			cout<<i<<" "<<m-i<<endl;
	}
	return 0;
}

int judge(int af)
{
	int j;
	for(j=3;j<af;j+=2)
	{
		if(af%j==0)
		{
			return 1;
			break;
		}
	}
}


int main()
{
	int n,m,i,j,k;
	scanf("%d",&n);
	for(i=3;i<=(n/2);i=i+2)
	{
		for(j=2;j<=sqrt(i);j++)
		{
			if(i%j==0)
				break;
		}
		if(j>sqrt(i))
		{
			m=n-i;
			for(k=2;k<=sqrt(m);k++)
			{
				if(m%k==0)
					break;
			}
			if(k>sqrt(m))
			{
				printf("%d %d",i,n-i);
				printf("\n");
			}
		}
	}
	return 0;
}


//* ????2??m???
   //* ????
//*****
int susucheck(int a)
{int j;int flag=1;int l;
for(j=2;;j++)
{if(j*j<=a){ l=a/j;if(l*j==a) flag=0; }
else break;}
return flag;
}
int main()
{int m;
cin>>m;
int k;int i;
for(k=2;k<=m/2;k++)
	{if(susucheck(k)&&susucheck(m-k))

	cout<<k<<' '<<m-k<<endl;}
return 0;

}


int main ()
{
	int m, s, p,i,j;
	cin >>m;
	for (s = 3; s <= m / 2;s = s + 2)
	{
		p = m - s;
		for ( i = 2; i <= (int) sqrt (s); i = i + 1 )
			{if ( s % i == 0 )
			break;}
		for ( j = 2; j <= (int) sqrt (p); j = j + 1 )
			{if ( p % j == 0 )
			break;}
		if ( j == (int) sqrt (p) + 1 && i == (int) sqrt (s) +1)
			cout << s << " " <<p <<endl;
	}
	return 0;
}


int main()
{
    int m,i,j,n;
	scanf("%d",&m);
	for(i=3;i<=m/2;i+=2)
	{
		for(j=3;j*j<=i;j+=2)
			if(i%j==0)
				break;
		if(j*j<=i)
			continue;
		n=m-i;
		for(j=3;j*j<=n;j+=2)
			if(n%j==0)
				break;
		if(j*j>n)
			printf("%d %d\n",i,m-i);

	}

    return 0;
}


int main()
{
	int m, primeA, primeB;
	int i, k;
	cin >> m;
	for (primeA = 3; primeA <= m - 1; primeA +=2)
	{
		primeB = m - primeA;
		for (i = 2; i <= (int)sqrt(m); i++)
		{
			if (primeA % i == 0 && primeA != i)
			{
				break;
			}
		}
		for (k = 2; k <= (int)sqrt(m); k++)
		{
			if (primeB % k == 0)
			{
				break;
			}
		}
		if ((i == (int)sqrt(m) + 1) && (k == (int)sqrt(m) + 1) && (primeA <= primeB))
			cout << primeA << " " << primeB << endl;
	}
	return 0;
}


int main()
{
  int isprime(int n);
  int m,i;
  scanf("%d",&m);
  for (i=3;i<=(m/2);i+=2)
  {
     if(isprime(i)&&isprime(m-i))
       printf("%d %d\n",i,m-i);
  }

}
int isprime(int n)
{
   int i;
   for (i=2;i*i<=n;i++)
     if (n%i==0)
       return 0;
   return 1;
}


int ss(int n)
{
int i,j,t=0;
for(i=2;i*i<=n;i++)
{
if(n%i == 0)
break;
}
if(i*i>n)
return 1;
else
return 0;
}
int main()
{
	int m,a;
	scanf("%d",&m);
	for(a=3;a<=m/2;a++)
	{
	   if(ss(a)&&ss(m-a))
	   {
	      printf("%d %d\n",a,m-a);
	   }
	}
	return 0;
}


//int main()

    int f(int n)
    {
        int j=0,m;
        //if(n==2)
        //return 1;
        //else

          for(int i=2;i<n;i++)
          {
                m=n%i;
                if(m==0)
                j=j+1;

          }
          if(j==0)
          return 1;
          else
          return 0;

    }
int main()
{
    int n,h;
    scanf("%d",&n);
    for(int k=2;k<=n/2;k++)
    {
       h=n-k;
       if((f(h)==1)&&(f(k)==1))
       printf("%d %d\n",k,h);
    }
    getchar();
    getchar();

}


int fun(int x)
{
    int b=1;
    for(int a=2;a<x;a++)
    {
       if(x%a==0)
       {
          b=0;
          break;
       }
    }
    return b;
}
main()
{
   int m,n,k,i;
   scanf("%d",&m);
   n=m/2;
   k=(n+1)/2;
   for(i=2;i<=k;i++)
   {
      int c=2*i-1;
      if(fun(c)==1&&fun(m-c)==1)
         printf("%d %d\n",c,m-c);
   }
   getchar();
   getchar();
}


int main()
{
	int m,n,k,j,i,l,p;
	scanf("%d",&m);
	for(n=3;n<=m/2;n++){
		p=sqrt(n);
		for(i=2;i<=p;i++){
			if(n%i==0)break;
		}
		if(i>p){
			k=m-n;
			l=sqrt(k);
			for(j=2;j<=l;j++){
					if(k%j==0)break;
			}
			if(j>l)
				printf("%d %d\n",n,k);
					}

	}
	return 0;
}


int SUSHU (int x)
{
	int d = 2, none = 1, result = 0;
	while (d * d <= x)
	{
		if (x % d == 0)
		{
			none = 0;
			break;
		}
		else
			d += 1;
	}
	if (none == 1)
		result = 1;
	return result;
}

int main()
{
	int m, a = 3, b;
	cin >> m;
	while (2 * a <= m)
	{
		b = m - a;
		if ((b % 2 != 0) && (SUSHU(a) == 1) && (SUSHU(b) == 1))
		{
			cout << a << " " << b << endl;
		}
		a += 2;
	}
}


int leap(int a)
{
	int t=1,i=0;
	if(a==2||a==3)  return t;
	else
	{
		for(i=2;i*i<=a;i++)
       	{
			if(a%i==0)
		   {
			t=0;
			break;
		    }
		}
	}
	return t;
}
int main()
{
	int i,m;
	scanf("%d",&m);
	for(i=2;i<=m/2;i++)
	{
		if(leap(i)&&leap(m-i))
		{
			printf("%d %d\n",i,m-i);
		}
	}
	return 0;
}


int n;
void main()
{
	int a;
	scanf("%d",&n);
	for(a=3;a<=n-a;a+=2){
		if(chose(a)&&chose(n-a))
			printf("%d %d\n",a,n-a);
	}
}
int chose(int n)
{
	int i;
	if(n==3)
		return 1;
	else if(n%2){
		for(i=3;i<=sqrt(n)+2;i+=2)
			if(!(n%i))
				break;
		if(i>sqrt(n))
			return 1;
		else
			return 0;
	}
	else
		return 0;
}


int main()
{
	int n, k, g, a, b;
	cin >> n;

	for (a = 3; a <= n / 2; a += 2)
	{
		k = 0; g = 0;
		for (int i = 3; i <= a; i += 2)
		{
			if (a % i != 0)
				continue;
			else
				k++;
		}
		b = n - a;
		for (int i = 3; i <= b; i += 2)
		{
			if (b % i != 0)
				continue;
			else
				g++;
		}
		if (k == 1 && g == 1)
			cout << a << " " << b << endl;
	}
	return 0;
}


int main()
{
	int m,a,k,b;
	scanf("%d",&m);

	if(m==6)
		printf("3 3\n");
	else
	{
		for(k=1;4*k+2<=m;k++)
		{
			a=2*k+1;
			b=m-a;

			int i=2;
			while(i*i<=a)
			{
				if(a%i==0) break;
				i++;
			}

			int j=2;
			while(j*j<=b)
			{
				if(b%j==0) break;
				j++;
			}

			if(i*i>a&&j*j>b) printf("%d %d\n",a,b);
		}
	}

	return 0;
}


void main()
{
 int a,b,c,d;
 scanf("%d",&a);
 for(b=3;b<=a/2;b+=2)
 {
  for(c=2;c<=sqrt(b);c++)
   if(b%c==0) break;
  if(c>sqrt(b))
   d=a-b;
  else
   continue;
  for(c=2;c<=sqrt(d);c++)
   if(d%c==0) break;
  if(c>sqrt(d))
   printf("%d %d\n",b,d);
 }
}


int main()
{
	double n;
	cin >> n;
	int i,j;
	int k,l;
	double t,s;
	for(i=3;i<=n/2;i+=2)
	{
		t=sqrt((double)i);
		for(j=2;j<=t;j++)
		{
			if(i%j==0)
				break;
		}
		if(j>t)
		{
			l=n-i;
			s=sqrt((double)l);
			for(k=2;k<=s;k++)
			{
				if(l%k==0)
					break;
			}
			if(k>s)
			{
				cout << i << " "<< l<<endl;
			}
		}
	}
	return 0;
}


int f(int n,int m)
{
    int i,sushu,j;
    sushu=0;
    for(i=2;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            sushu=-1;
        }

    }
    if(sushu==0)
    {
        for(j=2;j<=sqrt(m-n);j++)
        {
            if((m-n)%j==0)
            {
                sushu=-1;
            }
        }
    }
    if(sushu==0)
    {
        printf("%d %d\n",n,m-n);
    }
}

int main()

{
    int exp,c,b,a[100],days,w,m;
    int i,t,T,n,s,t2,j,k,len,x,y,ip,u;

    long e,p,q,r,sp,sq,sr;

    double d,h,g[100];

    scanf("%d",&m);
    for(i=3;i<=m/2;i=i+2)
    {
        f(i,m);
    }
    return 0;
}


int prime(int a)
{
int i,n;
if(a==1)return 0;
n=(int)sqrt((double)a);
for(i=2;i<=n;i++)
if(a%i==0)return 0;
 return 1;
}
void main()
{
  int i,m;
  scanf("%d",&m);
  for(i=3;i<=m/2;i=i+2)
  { if(prime(i)&&prime(m-i)) {printf("%d %d\n",i,m-i); continue;}}
}


void main()
{
 int flag(int n);
 int m,i,a,b;
 scanf("%d",&m);
 while((m>=6)&&(m%2==0))
  {
   for(i=2;i<=m/2;i++)
    {
      if(flag(i)==0&&flag(m-i)==0)
      printf("%d %d\n",i,m-i);
    }
   break;
  }
}
int flag(int n)
{
 int c,k,i;
 k=sqrt(n);
 for(i=2,c=0;i<=k;i++)
  {
   if(n%i==0)
    {c=1;break;}
  }
 return(c);
}


int main()
{
 int n,j,i;
 char isprime[MAXN+1]={0,0};
 scanf("%d",&n);
 for(i=2;i<=n;i++)
 {
	 isprime[i]=1;
 }
 for(i=2;i<=n/2;i++)
 {
	 if(isprime[i])
	 {
		 for(j=i+i;j<=n;j+=i)
		 {
			 isprime[j]=0;
	 }
 }
 }

	for(j=2;j<=n/2;j++)
	{
		if(isprime[j]&&isprime[n-j])
		{
			printf("%d %d\n",j,n-j);
		}
	}

return 0;
}


int judge(int x)
{
    int i,j=1;
    for(i=2;i*i<=x;i++)
    if(x%i==0)
    {
        j=0;
        break;
    }
    return j;
}
void main()
{
    int m,i,j,p,q;
    scanf("%d",&m);
    for(i=2;i<m;i++)
    if(judge(i))
    {
        p=i;
        for(j=i;j<m;j++)
        if(judge(j))
        {
            q=j;
            if(p+q==m)
            {
                printf("%d %d\n",p,q);
                break;
            }
        }
    }
}


void gbc(int n);
int ispn(int p);
int main()
{
	int n;
	scanf("%d",&n);
	gbc(n);
return 0;
}
void gbc(int n)
{
	int half=n/2;
	int i;
	int a,b;
	for(i=3;i<=half;i=i+2)
	{
		a=ispn(i);
		b=ispn(n-i);
		if(a&&b)
		{
			printf("%d %d\n",i,n-i);
		}
	}
}
int ispn(int p)
{
	int i,half,isprime;
	isprime=1;
	if(p%2==0)
	{
		if(p==2)
		{
			return isprime;
		}else
		{
			isprime=0;
		return isprime;
		}
	}
	half=p/2;
	for(i=3;i<=half;i=i+2)
	{
		if(p%i==0)
		{
			isprime=0;
			break;
		}
	}
	return isprime;
}


int main(void)
{
    int i,j,m,k=0,temp=0;
    cin>>m;
    int arr_a[1300];
    for (i=3;i<=m;i++)
    {
        for (j=2;j<=floor(sqrt(i));j++)
            if (i%j==0) temp++;
        if (temp==0) arr_a[k++]=i;
        temp=0;
    }
    for (i=0;i<k;i++)
    {
        for (j=i;j<k;j++)
            if (arr_a[i]+arr_a[j]==m)
               cout<<arr_a[i]<<" "<<arr_a[j]<<endl;
    }
    return 0;
}


int sushu(int);
int main()
{
    int m;
    cin>>m;
    for(int i=2;i<=m/2;i++)
    {
        if(sushu(i)&&sushu(m-i))
        cout<<i<<" "<<m-i<<endl;
    }

    return 0;
}
int sushu(int n)
{
    int j;
    for( j=2;j<=sqrt(n);j++)
    {
        if(n%j==0)
        {
        return 0;
        break;
        }
    }
    if(j==(int)sqrt(n)+1)
    return 1;
}


int sushu(int w)
{
	int c,d;
	d=1;
	c=2;
	while(c<=w-1)
	{
		if(w%c==0)
		{
			d=0;
		break;
		}
		c++;
	}
	return d;
}

	int main()
{
	int m,p;
	scanf("%d",&m);
	p=3;
	while(p<=m/2)
	{
		if (sushu(p)&&sushu(m-p))
			printf("%d %d\n",p,m-p);
		p++;
	}
	return 0;
}


int f(int x)
{
    int i,t;
    double k;
    k=sqrt(x);
    if(x%2==0);
    t=0;
    if(x%2==1)
    {for(i=2;i<=k;i++)
     {
       if(x%i==0)
       break;
       }
       if(i>k)
       t=1;
       else
       t=0;
     }
       return t;
}
main()
{
   int m,j;
   scanf("%d",&m);
   for(j=3;j<=(m/2);j++)
   {
     if((f(j)==1)&&(f(m-j)==1))
     printf("%d %d\n",j,m-j);
     }
     getchar();
     getchar();
     getchar();
}


int main()
{
    int n, m, i, j;
    double k;

    cin >> n;

    for(i = 3; i <= n / 2; i = i + 2)
    {
        int r = 0;

        k = sqrt(i);

        for(j = 2; j <= k; j++)
           if(i % j == 0)
	  {
		r++; break;
	   }

        if(r)
           continue;
        r = 0;
        k = sqrt(n - i);

        for(j = 2; j <= k; j++)
            if((n - i) % j == 0)
	   {
		r++;  break;
             }

        if(r)
            continue;

        cout << i << " " << (n- i) << endl;
    }
    return 0;
}


int jss(int x);
int main(){
    int m,i;
    scanf("%d",&m);
    for(i=m-2;i>=m/2;i--){
                          if(jss(i)&&jss(m-i)){
                                               printf("%d %d\n",(m-i),i);
                          }
    }
    return 0;
}
int jss(int x){
    int j;
    int a=0;
    for(j=x-1;j>=3;j--){
                        if(x%j==0){
                                   a=1;
                                   break;
                        }
    }
    if(x%2==1&&a==0&&x!=1){
                     return 1;
    }
    else{
         return 0;
    }
}


int SS(int i);
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=3;i<=n/2;i++)
	{
		if(SS(i)&&SS(n-i))
			printf("%d %d\n",i,n-i);
	}
}

int SS(int i)
{
	int k;
	for(k=2;k<=i-1;k++)
		if(i%k==0)break;
		if(k<i)return 0;
		else
			return 1;
}


int isprime(int n)
{
	int i;
	for(i=2;i<n;i++)
		if(n%i==0)
			return 0;
		return 1;
}
int main()
{
	int m,i;
	scanf("%d",&m);
	if((m%2==0)&&(m>=6)&&(m<=10000))
	{
		for(i=3;i<=m/2;i=i+2)
		{
			if(isprime(i)&&isprime(m-i))
				printf("%d %d\n",i,m-i);
		}
	}
	return 0;
}


int inverse(int a)
{int i=0,b=0,c=0;
	do
	{
		if(a<0){c=1;a=fabs(a);}
		b=b*10+a%10;
		a/=10;
		i++;
	}
	while(a>0);
	if(c==1)b=-b;
	return b;
}
void main()
{
	int i,num;
    for(i=0;i<6;i++)
	{
		scanf("%d",&num);
		printf("%d\n",inverse(num));
	}
}


int fxs(int x)
{
  int i;
  int y=0;
  for(i=10;x!=0;)
  {
    y=y*10+x%i;
    x=x/i;
  }
  return y;
}
main()
{
 for(int i=1;i<=6;i++)
 {
   int a,b;
   scanf("%d",&a);
   b=fxs(a);
   printf("%d\n",b);
 }
}


int main()
{
	int reverse(int num);
	int i,a[6],b[6];
	for(i=0;i<6;i++)
	{
		scanf("%d",&a[i]);
		b[i]=reverse(a[i]);
	}
	for(i=0;i<6;i++)
	{
		printf("%d\n",b[i]);
	}
	return 0;
}
int reverse(int num)
{
	int s=0,k;
	do
	{
		k=num%10;
		num=num/10;
                   s=(s+k)*10;
	}
           while(num!=0);
s=s/10;
return(s);
}


int reverse(int num)
{int x=0,y=1,i=0,j=0;int fuhao=1;int a[12];
//cin>>num;
if(num<0)fuhao=-1;
num=abs(num);
while(i<12){
	if(num<pow(10,(double)i))break;
	y=10*y;
	i++;}
//cout<<i;

for(j=1;j<=i;j++){a[j]=num/(int)pow(10,(double)(i-j));num=num-a[j]*(int)pow(10,(double)(i-j));}
for(j=0;j<i;j++)//cout<<a[j]<<endl;
	x=x+a[i-j]*pow(10,(double)(i-j-1));
//cout<<x<<endl;

x=fuhao*x;

return (x);

}
int main()
{int i=0;int num;
	for(i=1;i<=6;i++)
	{cin>>num;cout<<reverse(num)<<endl;}
	return 0;
}


//?????
//??????
//?????
int QuLing(int num)
{
	while(num%10==0)
		num/=10;
	return num;
}
void reverse(int num)
{
	cout<<num%10;
	if(num/10!=0) reverse(num/10);
	else cout<<endl;
}

int main()
{
	int a[6];
	for(int i=0;i<6;i++)
		cin>>a[i];
	for(int i=0;i<6;i++)
		if(a[i]>=0)	reverse(QuLing(a[i]));
		else
		{
			cout<<"-";
			reverse(QuLing(-a[i]));
		}
	return 0;
}


//#include<stdafx.h>

int reverse(int num)
{
	int y,z=0;

	if(num>0)
	{
		while(num>=1)
		{
                           y=num%10;
			z=10*z+y;
			num=num/10;
		}
	}
         else if(num==0) z=0;
	else
	{
		num=-num;
		while(num>=1)
		{
                            y=num%10;
			z=10*z+y;
			num=num/10;
		}
		z=-z;
	}
	return z;
}

void main()
{
	int a[6],i;

	for(i=0;i<6;i++)
	{
		scanf("%d",&a[i]);
		printf("%d\n",reverse(a[i]));
	}
}


int main()
{
    void dx ( char str[]);
    int j;
    char str[100];
    for(j=1;j<=6;j++)
      {
        cin.get(str,100,'\n');
        dx (str);
        getchar();
      }

    return 0;
}

   void  dx ( char str[])
   {
     int i=0;
     if(str[0]=='-')
      {
       cout<<str[0];
       for(i=strlen(str)-1;i>=1;i--)
         if(str[i]==48) continue;
         else break;
       for(i;i>=1;i--)
         cout<<str[i];
       cout<<endl;
       }
      else
        {
          for(i=strlen(str)-1;i>=1;i--)
            if(str[i]==48) continue;
          else break;
          for(i;i>=0;i--)
              cout<<str[i];
          cout<<endl;
        }
     }


int main()
{
	int reverse(int sum);
	int sum,i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&sum);
		reverse(sum);
	}

	return 0;
}

int reverse(int sum)
{
	int yushu;
	if(sum<0)
	{
		printf("-");
		sum=-sum;
	}
	if(sum==0) printf("%d",sum);
	yushu=sum%10;
	while((yushu==0)&&(sum!=0))
	{
	    sum=sum/10;
		yushu=sum%10;
	}

	while(sum!=0)
	{
		printf("%d",yushu);
		sum=(sum-yushu)/10;
		yushu=sum%10;
	}
	printf("\n");
	return 0;
}


long long reverse(int n){
int flag=0;
if (n<0)
flag=1,n=-n;
int a=1,t=0,n1=0;
while (10*a<=n)
a*=10,t++;
for (int i=0;i<=t;i++)
n1+=n/a*(int)pow((double)10,i),n%=a,a/=10;
if (flag==1)
n1=-n1;
return n1;
}

int main(){
        int n;
for (int i=1;i<=6;i++)
{
cin >> n;
cout << reverse(n) << endl;
}
        return 0;
}


int reverse(int num){
	int k,N[100],i,rev;
	rev=0;
	if(num<10)
		return num;
	if(num>=10){
		k=0;
		while(1){
			if(num>0){
				N[k]=num%10;
				k++;
				num/=10;
			}else
				break;
		}
		for(i=0;i<k;i++)
			rev+=pow(10,i)*N[k-1-i];
		return rev;
	}
}

int main(){
	int i,sz[6],rev[6];
	for(i=0;i<6;i++)
		scanf("%d",&sz[i]);
	for(i=0;i<6;i++){
		if(sz[i]<0){
			sz[i]=-sz[i];
			rev[i]=reverse(sz[i]);
			printf("-%d\n",rev[i]);
		}else{
			rev[i]=reverse(sz[i]);
			printf("%d\n",rev[i]);
		}
	}
	return 0;
}


int reverse(int num);
void main()
{
	int a[6],i,b[6];
	for(i=0;i<6;i++)
	scanf("%d",&a[i]);
	for(i=0;i<6;i++)
	{
		b[i]=reverse(a[i]);
	printf("%d\n",b[i]);
	}
}

int reverse(int num)
{
	int s=0,i,j,k=0,t;
	if(num<0)
	{
		num=0-num;
		k=1;
	}
	for(i=0;;i++)
	{
		t=pow(10,i);
		if((num%t)==num)
			break;
	}
	for(j=0;j<i;j++)
	{
		s+=(num%10)*pow(10,i-j-1);
		num=(num-num%10)/10;
	}
	if(k)
		return -s;
	else
		return s;
}


void main()
{
    int reverse(int num);
    int num,i;
    for(i=0;i<6;i=i+1)
    {
	scanf("%d",&num);
	num=reverse(num);
	printf("%d\n",num);
    }
}

int reverse(int num)
{
    int a[5];
    int n,i,t,sign=1;
    if(num==0)
	return(num);
    else
    {
    if(num<0)
    sign=-1;
    num=num*sign;
    n=log10(num);
    for(i=0;i<=n;i=i+1)
    {
	a[i]=num/pow(10,n-i);
	num=num-a[i]*pow(10,n-i);
    }
    for(i=0;i<n/2+1;i=i+1)
    {
	t=a[i];
	a[i]=a[n-i];
	a[n-i]=t;
    }
    for(i=0;i<=
    n;i=i+1)
    {
	num=num+a[i]*pow(10,n-i);
    }
    num=num*sign;
    return num;
    }
}


void main()
{
	int reverse(int num);

	int num=0;
	scanf("%d",&num);
	printf("%d\n", reverse(num));
	scanf("%d",&num);
	printf("%d\n", reverse(num));
	scanf("%d",&num);
	printf("%d\n", reverse(num));
	scanf("%d",&num);
	printf("%d\n", reverse(num));
	scanf("%d",&num);
	printf("%d\n", reverse(num));
	scanf("%d",&num);
	printf("%d\n", reverse(num));
}

int reverse (int num)
{
	int r=0,flag=0;
	if (num==0) r=0;
	else
	{
		switch (num/abs(num))
		{
		case -1: num=num*(-1);flag=1;
		case 1: while(num)
				{
					r=r*10+num%10;
					num=num/10;
				}
		}
		if (flag==1) r=r*(-1);
	}

	/*
		?????num???????r=0?flag=0???switch???
			[1](num=0) r=0,break??
			[2](num<0) ?num?-1?flag=1????break????[3]????
			[3](num>0)
			?while???????????num??0?
				r=r*10+num%10;
				num=num/10;
		??switch????flag???0??????r??-1?
	*/
	return(r);
}


int reverse(int num)
{
int c[6];
int i,j,k;
int w=0;
for(i=1;i<=6;i++)
{
c[i]=0;
c[i]=num%10;
num=num-c[i];
if(num==0)
break;
num=num/10;
}
for(j=1;j<=i;j++)
{
for(k=1;k<=(i-j);k++)
c[j]=c[j]*10;
}
for(k=1;k<=i;k++)
w=w+c[k];
return(w);
}

int main()
{
    int n,m,j;
    for(j=1;j<=6;j++)
    {
    scanf("%d",&n);
    m = reverse(n);
    printf("%d\n",m);
    }
    getchar();
    getchar();
    return 0;
}


void reverse(int n);
int main()
{
	int n;
	int i;
	for (i=1;i<=6;i++)
	{
		scanf("%d",&n);
		reverse(n);
	}
	return 0;
}
void reverse(int n)
{
	int a[12];
	int tmp;
	int i,j;
	int state=0;
	tmp=(n>=0)? n:-n;
	for (j=0;tmp>=1;j++)
	{
		a[j]=tmp%10;
		tmp/=10;
	}
	if (n<0)
	{
		printf("-");
	}
	for (i=0;i<j;i++)
	{
		if (state)
		{
			printf("%d",a[i]);
		}
		else
		{
			if (a[i]!=0 &&state==0)
			{
				printf("%d",a[i]);
				state=1;
			}
		}
	}
	if (!state)
	{
		printf("0");
	}
	printf("\n");
}


int main()
{
	int i,a,b;
	int reverse(int);
	for(i=0;i<6;i++){
		scanf("%d", &a);
		if(a>=0){
		b=reverse(a);
		}
		if(a<0){
		a=-a;
		b=-reverse(a);
		}
		printf("%d", b);
                if(i<5) printf("\n");
	}
	return 0;
}

int reverse(int a)
{
	int j,b=0,k, c[10]={0};
	for(j=9;j>=0;j--){
		c[j]=a%10;
		a=a/10;
		if(a==0) break;
	}
	for(k=9;k>=j;k--){
		b=b*10+c[k];
	}
	return b;
}


int main()
{
	int i,n;
	int reverse(int num);
	for (i=0;i<6;i++)
	{
		scanf("%d",&n);
		printf("%d\n",reverse(n));
	}
	return 0;
}

int reverse(int num)
{
	int ans=0;
	do
	{
		ans = ans*10+num%10;
		num = num / 10;
	}
	while (num!=0);
	return ans;
}


int re(int num){
    int sz[30],i,value,x;
    value=1;
    i=0;
    if(num<0) {num=-num;value=-1;}
    for(int j=0;j<30;j++) sz[j]=0;
    while(num>0) {
                 sz[i++]=num%10;
                 num=num/10;
                 }
    for(i=29;i>=0;i--){
                       if(sz[i]!=0){
                                    x=i;
                                    break;
                                    }
                       }
    for(i=0,num=0;i<=x;i++) num=num*10+sz[i];
    num=num*value;
}

int main(){
    int num[6],i;
    for(i=0;i<6;i++){
                     scanf("%d",&num[i]);
                     num[i]=re(num[i]);
                     }
    for(i=0;i<6;i++){
                     if(i==5) printf("%d",num[i]);
                     else printf("%d\n",num[i]);
                     }
    scanf("%d",&i);
    return 0;
}


int re(int n){
	int result=0;
	if(n>0){
	   while(n>0){
		  result=result*10+n%10;
		  n/=10;
	   }
	}else if(n<0){
		n=0-n;
		while(n>0){
		  result=result*10+n%10;
		  n/=10;
	   }
	   result=0-result;
	}
	return result;
}
int main(){
	int i,z,f;
	for(i=0;i<6;i++){
		scanf("%d",&z);
		f=re(z);
		printf("%d\n",f);
	}
	return 0;
}


void main()
{
int a[6],i;
int reverse(int dividend);
for(i=0;i<6;i++)
{
scanf("%d",&a[i]);

printf("%d\n",reverse(a[i]));
}
}

int reverse(int devidend)
{
int result=0,remainder;

if(devidend<0)
{
	devidend=fabs(devidend);

     while(devidend>0)
     {
     remainder=devidend%10;result=result*10+remainder;
     devidend=devidend/10;
     }

    result=-result;
   }

   else if(devidend>=0)
   {
	   do
   {
   remainder=devidend%10;result=result*10+remainder;
   devidend=devidend/10;
   }
    while(devidend>0);
   }
return(result);
}


int reverse(char n[8]);

int main(){
	int j,z,i,c,k;
	char jieguo[6][8];
	char su[8];
	for(j=0;j<6;j++){
		scanf("%s",su);
		c=strlen(su);
		z=reverse(su);
		switch(z){
		case 1: {jieguo[j][0]=su[0];
			jieguo[j][1]='\0';
			break;}
		case 2: {jieguo[j][0]=su[0];
			for(i=1;i<c;i++){
				jieguo[j][i]=su[c-i];
			}
			jieguo[j][c]='\0';
				break;}
		case 3:{for(i=0;i<c;i++){
					jieguo[j][i]=su[c-1-i];
			   }
			   jieguo[j][c]='\0';
			   break;
			   }
		case 4:{jieguo[j][0]=su[0];
			for(i=1;i<c;i++){
				if(su[c-i]!='0')
					break;
			}
			for(k=1;k<=c-i;k++){
			jieguo[j][k]=su[c-i-k+1];
			}
			jieguo[j][k]='\0';
			   }
			   break;
		case 5:{for(i=0;i<c;i++){
				if(su[c-i-1]!='0')
					break;
			   }
			   for(k=0;k<c-i;k++){
			   jieguo[j][k]=su[c-i-k-1];
			   }
			   jieguo[j][k]='\0';
			   }break;
		}
	}
	for(j=0;j<6;j++){
		printf("%s\n",jieguo[j]);
	}
	return 0;
}
int reverse(char n[8]){
	int b,i,jieguo;
	b=strlen(n);
	if(b==1){
		jieguo=1;
	}else{
		if(n[0]=='-'){
			jieguo=2;
			if(n[b-1]=='0'){
				jieguo=4;
			}
		}else{
			jieguo=3;
			if(n[b-1]=='0'){
				jieguo=5;
		}
	}
	}
	return(jieguo);
}


int reverse(int num)
{
 int f=1,s=0;
 if (num<0)
   {
   f=0;
   num=-num;
   }
 for (;num!=0;)
   {
   s=s*10+num%10;
   num=num/10;
   }
 if (f==0)
   s=-s;
 return(s);
}
void main()
{
 int i,n;
 for (i=1;i<=6;i++)
   {
   scanf("%d",&n);
   printf("%d\n",reverse(n));
   }
}


void main()
{
	int reverse(int num);
	int i,a[6],d[6];
	for(i=0;i<6;i++)
	 scanf("%d",&a[i]);
	for(i=0;i<6;i++)
	{if (a[i]>0)
	d[i]=reverse(a[i]);
	else d[i]=(-1)*reverse(-a[i]);
	printf("%d\n",d[i]);}
}

int reverse(int num)
{
	int b[7],c[7],j,d,answer;
	for(j=0;j<7;j++)
	{
		b[j]=floor(num/(pow(10,j)));}
	for(j=0;j<6;j++)
	{
		c[6-j]=b[j]-10*b[j+1];}
	c[0]=b[6];
	d=0;
	for(j=0;j<7;j++)
	{
		if(c[j]==0)
			d=d+1;
	else break;}
	answer=0;
	for(j=d-1;j<7;j++)
	{
		answer=answer+pow(10,j-d)*c[j];}
	return answer;
}


int main(void)
{
    int i,n,flag,n1;
    int f(int n);

    for(i=1;i<=6;i++){
    scanf("%d",&n);
    if (n>0) flag=1;
    else {flag=-1;n=-n;}
    n1=f(n);
    printf("%d\n",flag*n1);
    }
}
int f(int n)
{
  int s,nn;

  s=n;nn=0;
  while(s>0){
    nn=nn*10+s%10;
    s=s/10;
  }

  return nn;
}


const int n=6;
long down(long x)
{
     long k,m;
     k=x;
     m=0;
     while(k>0)
     {
        m=m*10;
        m=m+k%10;
        k=k/10;
        }
     return m;
     }
main()
{
      long i,k,l;
      for(i=1;i<=n;i++)
      {
          l=1;
          scanf("%d",&k);
          if(k<0)
          {
                 l=-1;
                 k=-k;
                 }
          k=down(k);
          if(l==-1) k=-k;
          printf("%d\n",k);
          }
      getchar();
      getchar();
      }


int reverse(int num)
{
    int a[20],j,p,x;
    if(num<0)
    {cout<< "-";
    num=-num;}
    else if(num==0)
    {cout<<0;}
	for(j=0;num>0;j++)
	{a[j]=num%10;
	num=num/10;
	//cout<<a[j]<<' '<<j<<endl;
	}
	p=j;
	for(j=0;j<=p;j++)
	{   //cout<<a[j];
		if(a[j]!=0)
     	{x=j;break;}
	}

	for(j=x;j<p;j++)
	cout<<a[j];
}
int reverse(int);
int main()
{
	int i,n;
	for(i=0;i<6;i++)
	{
	cin>>n;
	reverse(n);
	cout<<endl;
	}cin.get();return 0;
}


void main()
{
   int reverse(int num);
   int num[6],i;
   for(i=0;i<6;i++)
	   scanf("%d",&num[i]);
   for(i=0;i<6;i++)
	   num[i]=reverse(num[i]);
   for(i=0;i<6;i++)
	   printf("%d\n",num[i]);
}

int reverse(int num)
{
	int i=0,n=0,flag;
	int a[100];
	if(num==0)
		num=0;
	else
    {
		if(num>0)
			flag=1;
		else
			flag=-1;
		num=abs(num);
	{
		while(num>0)
		{
			a[i]=num%10;
			i++;
			num=(num-num%10)/10;
			n++;
		}
		for(i=0;i<n;i++)
			num=num+a[i]*pow(10,n-i-1);
	}
		num=num*flag;
	}
	return(num);
}


int main()
{
	char a[10],b[10],c[10],d[10],e[10],f[10];
	void reverse(char x[10]);
	void putstr(char y[10]);
	reverse(gets(a));
	reverse(gets(b));
	reverse(gets(c));
	reverse(gets(d));
	reverse(gets(e));
	reverse(gets(f));
	putstr(a);
	putstr(b);
	putstr(c);
	putstr(d);
	putstr(e);
	putstr(f);
}

void reverse(char x[10])
{
	int length,i,j,t;
	char p[10]={0};
	length=strlen(x);
	if (x[0]==45)
	{
		if(x[1]==48)
		{
			x[0]=48;
			x[1]='\0';
		}
		else {
		for(i=length-1,j=1;i>=1;i--,j++)
				p[j]=x[i];
		for(i=1;i<j;i++)
			if (p[i]!=48) break;
		for (t=1;i<j;i++,t++)
			x[t]=p[i];
		x[t]='\0';
		}
	}
	if (x[0]!=45)
	{
		if(x[0]==48)
		{
			x[0]=48;
			x[1]='\0';
		}
		else{
		for(i=length-1,j=0;i>=0;i--,j++)
				p[j]=x[i];
		for(i=0;i<j;i++)
			if (p[i]!=48) break;
        for (t=0;i<j;i++,t++)
			x[t]=p[i];
		x[t]='\0';
		}
	}
}

void putstr(char y[10])
{
	puts(y);
}


int reverse(int n)
{
	int a[10]={0};
	int sum;
	int i,j;
	i=0;sum=0;

	while(n>0)
	{
		a[i]=n%10;
		n=n/10;
		i=i+1;
	}

	for(j=0;j<=i-1;j++)
	{
		sum=sum+a[j]*pow(10,i-1-j);
	}

	return sum;
}

int main()
{
	int i;
	int a;
	for(i=1;i<=6;i++)
	{
		scanf("%d",&a);
		if(a<0)
		{
			printf("-");
			a=fabs(a);
			printf("%d\n",reverse(a));
		}
		else
			printf("%d\n",reverse(a));
	}

	return 0;
}


void main()
{
int i,ans,n=0;
//char c;
int reverse(int num);
for(i=0;i<6;i++)
{
	scanf("%d",&n);
	ans=reverse(n);
	printf("%d\n",ans);
}
}

int reverse(int num)
{
int m=0,flag=1,w;
if(num<0) {flag=0;num=-num;}
w=(int)log10(num);
for(;w>=0;w--)
{
	m=m*10+num%10;
	num=num/10;
}
if(flag==0) m=-m;
return m;
}


void reverse ( )
{
      int i,len,aaa,bbb;
      char num[100],exnum[100];
      char *p;
      gets(num);
      aaa=0;
      if (num[0]=='-')
      {
            len= strlen (num)-1;
            for(i=0;i<=len-1;i++)
            {
                  exnum[len-1-i]=num[i+1];
            }
            aaa=1;
      }
      else
      {
            len=strlen(num);
            for(i=0;i<=len-1;i++)
            {
                  exnum[len-1-i]=num[i];
            }
      }
      if (aaa==1)
      {
            printf("-");
      }
      bbb=0;
      for (i=0;i<=len-1;i++)
      {
            if (exnum[i]=='0')
            ;
            else
            {
                  bbb=1;
                  break;
            }
      }
      for (;i<=len-1;i++)
      {
            printf("%c",exnum[i]);
      }
      if (bbb==0)
      {
            printf("0");
      }
      printf("\n");
}
int main()
{
      int i;
      for (i=1;i<=6;i++)
      {
            reverse();
      }
      return(0);
}


long reverse(long n)
{
    long g = n;
    long a=0,b=0;
        while(g!=0)
    {

              a = g % 10;
              b = b*10+a;
              g = g/10;

    }

    return b;

}

main()
{
 long n,b,i;
for(i=0;i<=5;i++)
{
 scanf("%d",&n);
 b = reverse(n);
 printf("%d\n",b);
}

}


int main()
{
	int reverse(int num1);
	int num1,num2=0;
	while(cin>>num1)
	{
		num2=reverse(num1);
		cout<<num2<<endl;
	}
	return 0;
}

int reverse(int num1)
{
	int num[1000],i,j,num2=0;
	for(i=0;;i++)
	{
		if(num1/10==0)
		{
			num[i]=num1;
			break;
		}
		else
		{
				num[i]=num1%10;
				num1=num1/10;
	     }
	}
	for(j=0;j<=i;j++)
	{
		num2=10*num2+num[j];
	}
	return(num2);
}


 int f(int n)

{
     int m=0;
while(n!=0){
       m=m*10+n%10;
       n=n/10;
}
return m;
}

int main()
{
   int a;
    for(int i=0;i<6;i++){
            scanf("%d",&a);
            printf("%d\n",f(a));
            }

    return 0;
    }


int clear(int num)
{
	while(num%10==0)  num=num/10;
	return num;
}

int reverse(int num)
{
	if(num!=0)
	{
		cout<<(num%10);
		reverse(num/10);
	}
	return 0;

}
int main()
{
	for(int i=0;i<6;i++)
	{
		int num;
		cin>>num;
		if(num<0)
		{cout<<'-';num=abs(num);}
		if(num==0) cout<<'0';
		else
		{
		   num=clear(num);
		   reverse(num);

		}
		if(i!=6) cout<<endl;

	}
}


int reverse(int num){
	int length,N=abs(num),i;
	for(i=0;N>=pow(10,i);i++)
		length=i+1;
	int sum=0,l=length;
	for(i=0;i<=length-1;i++,l--)
	sum+=(int)(num%(int)pow(10,i+1)/pow(10,i))*pow(10,l-1);
	return sum;
}
int main(){
int num,i;
for(i=0;i<6;i++){
	scanf("%d",&num);
	printf("%d\n",reverse(num));
}
return 0;
}


void input();
void reverse();
void output();

int i,j,k, in[7] = {0}, out[7] = {0};

int main ()
{
	input();

	reverse();

	output();

	return 0;
}

void input()
{
	for (i = 1; i <=6; i++)
		cin >> in[i];
}

void reverse()
{
	int negative = 0;
	for (i = 1; i <=6; i++)
	{
		negative = 0;
		if (in[i] == 0)
			continue;
		if (in[i] < 0 )
		{
			negative = 1;
			in[i] = -in[i];
		}
		while (in[i] != 0)
		{
			out[i] = out[i]*10+in[i]%10;
			in[i] /= 10;
		}
		if (negative == 1)
			out[i] = -out[i];
	}
}

void output()
{
	for (i = 1; i <= 6; i++)
		cout << out[i] << endl;
}


int rev(int a);
int main()
{
	int a,b,i;
	for(i=0;i<6;i++){
	scanf("%d",&a);
    b=rev(a);
	printf("%d\n",b);
		}
	return 0;
}
int rev(int a){
	int m,n=0,j;
	for(j=0;j<10;j++){
		m=a%10;
		a=a/10;
		n=n*10+m;
		if(a==0)
			break;
	}
	return n;
}


int reverse(int num)
{
int c[6];
int i,j,k;
int w=0;
for(i=1;i<=6;i++)
{
c[i]=0;
c[i]=num%10;
num=num-c[i];
if(num==0)
break;
num=num/10;
}
for(j=1;j<=i;j++)
{
for(k=1;k<=(i-j);k++)
c[k]=c[k]*10;
}
for(k=1;k<=i;k++)
w=w+c[k];
return(w);
}
main()
{
int a[6],i,d;
for(i=0;i<=5;i++)
scanf("%d",&a[i]);
for(i=0;i<=5;i++)
{
if(a[i]>0)
{
d=reverse(a[i]);
    printf("%d\n",d);
}
else if(a[i]==0)
printf("0\n");
else
{
d=-reverse(-a[i]);
printf("%d\n",d);
}
}
getchar();
getchar();
getchar();
getchar();
}


int reverse(int num)
{
    if(num==0||num==-0)
        return 0;

    int x=abs(num);
    while(x%10==0)
    {
        x/=10;
    }

    int i=0, sum=0, sz[100];
    for(;x!=0;x/=10)
    {
        sz[i++] = x%10;
    }

    x=i;
    for(i=0;i<x;i++)
    {
        sum+=sz[i]*pow(10,(x-i-1));
    }

    if(num<0)
        sum=-sum;

    return sum;
}

int main()
{
    int num, i;

    for(i=0;i<6;i++)
    {
        scanf("%d", &num);
        printf("%d\n", reverse(num));
    }

    return 0;
}


void inv(char str[])
{
	int l,m,i;
	char c;
	l=strlen(str);
	for(i=0;i<l/2;i++)
	{

		if(str[i]=='-') {l++;continue;}
		c=*(str+i);
		*(str+i)=*(str+l-1-i);
		*(str+l-1-i)=c;
	}
	m=atoi(str);
	printf("%d\n",m);
}
void main()
{
	int i;
	char a[6][9];
	for(i=0;i<6;i++)
		scanf("%s",a+i);
	for(i=0;i<6;i++)
		inv(*(a+i));
}


int r(int a, int b)
{
	int i,j;
	if(a<10)
	{
		return (b+a);
	}
	int sum=1;
	for(i=1;;i++)
	{
		if(sum>a)
		{
			break;}
		sum*=10;
	}
	b+=(a%10)*(sum/10);
	return (r(a/10,b));
}

int main()
{
	int a;
	int i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&a);
		if(a<0)
		{
			a=-a;
			printf ("%d\n",-r(a,0));
		}
		else
		{
			printf ("%d\n",r(a,0));
		}
	}
		return 0;
}


int main(int argc, char* argv[])
{int n,a(int num),s,i=0;
while(i<6)
{
	scanf("%d",&n);
	s=a(n);
	printf("%d\n",s);
	i++;
}
	return 0;
}

int a(int num)
{
	int x=0;
	while(num!=0)
	{
		x=x*10+num%10;
		num/=10;
	}
 return x;
}


//????????
int reverse(int);//?????
int main()
{
	int num=0;
	while(cin>>num)
	{
		cout<<reverse(num)<<endl;
	}
	return 0;
}
int reverse(int num)
{
	int i,sum=0,a[10]={0},count=0;
	if(num==0)
		return 0;
	else if(num<0)//?????????
	{
		cout<<"-";
		num=-num;
	}
	for(i=0;;i++)//??????
	{
		a[i]=num%10;
		num=num/10;
		count++;
		if(num==0)
			break;
	}
	for(i=0;i<10;i++)
	{
		sum=sum+a[i]*pow(10.0,count-i-1);//??????
	}
	return sum;
}


void reverse( int a)
{
    int i,l,b;
    i=0;
    if (a==0)   printf("0");
    while ((a%10)==0)
        {a=a/10;}
    while (a!=0)
    {
                if (a>0)
                {
                         b=a%10;
                         printf("%d",b);
                           a=a/10;

                 }
                else if (a<0)
                 {
                        b=a%10;
                        if (i==0)
                        printf("%d",b);
                        else
                              {
                                  b=-b;
                               printf("%d",b);
                               }
                         a=a/10;
                         i++;
                  }

      }

    }

int main()
{
    int m,a;
    int i=1;
    while (i<=6)
    {scanf("%d",&a);
    reverse( a);
    printf("\n");
    i++;}

    getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar(); getchar();
}


int reverse(int num);
int main(){
	int k,n;
	for(k=0;k<6;k++){
		scanf("%d",&n);
		printf("%d\n",reverse(n));
	}
	return 0;
}
int reverse(int num){
		int i,x,r,a=1;
		r=0;
		if(num<0){
			num=-num;
			a=-1;
		}
		for(i=1;i<12;i++){
			if(num<pow(10,i)){
				x=i;
				break;
			}
		}
		for(i=0;i<x;i++){
			if(i==0){
				r+=num%10*(int)(pow(10,x-1));
			}
			else{
				r+=(num%(int)(pow(10,i+1))-num%(int)(pow(10,i)))/(int)(pow(10,i))*(int)(pow(10,x-i-1));
			}
		}
		r=a*r;
		return r;
}


int reverse(int a);
int main()
{
	int a,i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&a);
		reverse(a);
		if(a==0)
			printf("0");
		printf("\n");
	}
	scanf("%d",1);
	return 0;
}
int reverse(int a)
{
	int d=0;
	if(a<0)
	{
		printf("-");
		a=-a;
	}
	while(1)
	{
        if(d==1)
            printf("%d",a%10);
		if(a%10!=0&&d==0)
		{
	        printf("%d",a%10);
			d=1;
		}

	    a=a/10;
	    if(a==0)
			break;
	}
	return 0;
}


int reverse(char*);
int main(int argc, char* argv[])
{
	int i;
	char a[6][10];
    for(i=0;i<6;i++)
	{
		scanf("%s",a[i]);
	}
	for(i=0;i<6;i++)
	{
		printf("%d\n",reverse(a[i]));
	}
	return 0;
}
int reverse(char* n)
{
    char a[10],b[10],c[10];
	int m,i;
	strcpy(a,n);
	m=strlen(a);
	for(i=0;i<m;i++)
	{
        b[i]=a[m-i-1];
	}
	b[m]='\0';
	if(b[m-1]=='-')
	{
		c[0]='-';
		for(i=1;i<m;i++)
		{
			c[i]=b[i-1];
		}
		c[m]='\0';
	}
	else
		strcpy(c,b);
	return atoi(c);
}


int num(int a)
{
	int b;
	b=abs(a);
	while(b%10==0){
		b=b/10;
	}
	if(a>0)return b;
	else return -b;
}
int reverse(int b)//???a??keyi
{
	int c=0,d;
	d=abs(b);
	while(d>0){
		c=c*10+d%10;
		d=d/10;
	}
	if(b>0)return c;
	else return -c;
}
int main()
{
	int i=0,x;
	int out[6];
	for(;i<6;i++){
		scanf("%d",&x);
		out[i]=reverse(num(x));
	}
	for(i=0;i<6;i++){

	printf("%d\n",out[i]);
	}
	return 0;
}


int cifang(int n)
{
    int i,t=1;
    for(i=0;i<n;i++)
    t=t*10;
    return t;
}
int reverse(int num)
{
    int i,j,k,count=0;
    int a[100];
    for(i=0;i<100;i++)
    a[i]=0;
    for(i=0;num!=0;i++)
    {
    a[i]=(num%cifang(i+1))/cifang(i);
    num=num-a[i]*cifang(i);
    count++;
    }
    int total=0;
    for(i=0;i<count;i++)
    {
    total=total+a[i]*cifang(count-i-1);
     }
     return total;
}
main()
{
      int k,i;
      for(i=6;i>0;i--)
      {
      scanf("%d",&k);
      printf("%d\n",reverse(k));
      }
      getchar();
      getchar();
}


int reverse(int num)
{
	int i,k,l,m,ans;
	if (num<0)
	{
		m=-1;
		num=0-num;
	}
	else m=1;
	k=0;
    while (num!=0)
	{
		k=k*10+num%10;
		num=(num-(num%10))/10;
	}
	ans=k*m;
	return ans;
}

int main()
{
	int r,t;
	for (r=0;r<6;r++)
	{
		scanf("%d",&t);
		printf("%d\n",reverse(t));
	}
}


int reverse(int num)
{   int a[11],i,j,flag,n;
    if (num==0) return 0;
    else if (num<0) flag=-1;
    else flag=1;
    num=abs(num);
    for (i=0;i<=10;i++) a[i]=0;
    i=0;
    while (num>0)
    {
      a[i]=num%10;
      num=num/10;
      i++;}
    i--;
    n=0;
    for (j=0;j<=i;j++)
    n=n*10+a[j];
    if (flag<0) return(-n);
    else return(n);
}
main()
{
      int i,num;
      for (i=0;i<6;i++)
      { scanf("%d",&num);
        num=reverse(num);
        printf("%d\n",num);
       }
}


int reverse(int num);
int main()
{
	for(int i=0;i<6;i++)
	{
		int a,r;
		scanf("%d",&a);
		r=reverse(a);
		printf("%d\n",r);
	}
	int a;
	scanf("%d",&a);
	return 0;
}
int reverse(int num)
{
	int a=num,s=0;
	int SZ[100];
	int n=1,i=0;
	while((a/10)!=0)
	{
		SZ[i]=a%10;
		a=a/10;
		i++;
	}
	SZ[i]=a%10;
	if(SZ[i]<0)
	{
		s=-SZ[0];
		for(int k=1;k<=i;k++)
		{
			s=s*10-SZ[k];
		}
		s=-s;
	}
	if(SZ[i]>=0)
	{
		s=SZ[0];
		for(int k=1;k<=i;k++)
		{
			s=s*10+SZ[k];
		}
	}
	return s;
}


int reverse(int num)
{
      int a,h,i,j,k,o=0,s=1,t=10,NUM=0,n[N];
      if(num<0)
      {
           num=0-num;
           o=1;
      }
      for(h=2;h<=N+2;h++)
      {
           s=s*10;
           if(num/s==0)
           break;
      }
      for(i=0;i<N;i++)
      {
           a=num%t;
           num=num/t;
           n[i]=a;
      }
      t=1;
      for(j=2;j<h;j++)
      {
           t=t*10;
      }
      for(k=0;k<N;k++)
      {
           NUM=NUM+t*n[k];
           t=t/10;
      }
      if(o==1)
      NUM=0-NUM;
      return NUM;
}
main()
{
      int num,i;
      for(i=1;i<=6;i++)
      {
           scanf("%d",&num);
           printf("%d\n",reverse(num));
      }
}


int flag=0;
void reverse(int num)
{
	if(flag==1||num%10!=0)//flag ??????????0??
	{
		if(num%10!=0) flag=1;
		cout<<num%10;
	}
	if(num/10!=0)
		reverse(num/10);//??
}
int main()
{
	int i;
	for(i=0;i<6;i++)
	{
		flag=0;
		int n,u;
		cin>>n;
		if(n<0)
		{
			cout<<'-';
			reverse(-n);
			cout<<endl;
		}
		else if(n>0)
		{
			reverse(n);
			cout<<endl;
		}
		else if(n==0)
		{
			cout<<'0'<<endl;
		}
	}
	return 0;
}


int reverse(int num)
{
 int a, rev=0;
 int i, count=0;
 for(i=0; ;i++)
   {
    a=num%10;
    rev=rev*10+a;
    num=num/10;
    if(num==0) break;
    }
 return rev;
}
 int main()
{
 int num;
 int rev;
 int a[6];
 int i;
 for(i=0; i<6; i++)
   {
    scanf("%d", &a[i]);
   }
 for(i=0; i<6; i++)
   {
 if(a[i]<0)
     {
      a[i]=-a[i];
      rev=reverse(a[i]);
      printf("%d\n", -rev);
     }
 else
    {
     rev=reverse(a[i]);
     printf("%d\n", rev);
    }
   }
 return 0;
}


int reverse(int num)
{
    int x=0,y=0,k=0;
    if(num==0)
    return 0;
    printf("\n");
    while(num>0)
    {
        x=num%10;
        y=y*10+x;
        num=num/10;
        if(num==0)
        break;
    }
    return y;
}
main()
{
    int n[6],i;
    for(i=0;i<6;i++)
    {
        scanf("%d",&n[i]);
        if(n[i]>=0)
        {
            reverse(n[i]);
            printf("%d\n",reverse(n[i]));
        }
        else
        {
            reverse(-n[i]);
            printf("-%d\n",reverse(-n[i]));
        }
    }
}


int reverse(int a)
{
  int s[100];
  int i=10,j,b=0;
  if (a<0)
  {
     a=a*(-1);
     for (j=1; ;j++)
     {
         s[j]=a%i;
         b=s[j]+b*10;
         a=a/i;
         if (a==0)
         break;
     }
     return -b;
  }
  else
  {
     for (j=1; ;j++)
     {
         s[j]=a%i;
         b=s[j]+b*10;
         a=a/i;
         if (a==0)
         break;
     }
  }
  return b;
}
int main ()
{
    int a[6],i;
    for (i=0;i<=5;i++)
    scanf ("%d",&a[i]);
    for (i=0;i<=5;i++)

        {
            printf ("%d\n",reverse(a[i]));
        }

getchar();
getchar();
getchar();
}


int reverse(int);
int main()
{
	int num;
	while (cin >>num)
	cout <<reverse(num) <<endl;

	return 0;
}
int reverse(int num)
	{
		int judge=0;
		if (num<0) { num=-num;judge=1;}
		int n[10]={0},count=0,reverses=0,i,j=1;
		do
		{
			n[count]=num%10;
			num=(num-n[count])/10;
			count++;
		}
		while (num!=0);
		for (i=count-1;i>=0;i--)
		{
			reverses+=n[i]*j;
			j*=10;
		}
		if (judge==1) reverses=-reverses;
		return(reverses);
	 }


int main()
{
	int reverse(int num);
	int i,p,q;
	for(i=1;i<=6;i++){
		scanf("%d",&p);
		q=reverse(p);
		printf("%d\n",q);
	}
	return 0;
}

int reverse(int num)
{
	int t,sign,b=0;
	t=abs(num);
	while(t>0){
		b=b*10+t%10;
		t/=10;
	}
	sign=(num>=0)?1:-1;
	b=sign*b;
	return b;
}


int reverse(int num){
	int sz[20];
	int i,fanxu=0,weishu=0;
	for(i=0;;i++){
		sz[i]=num%(int)pow(10,i+1);

		if(num%(int)pow(10,i+1)==0&&num/(int)pow(10,i+1)==0){
			weishu=i;
			break;
		}
		num=num-sz[i];
	}
	for(i;i>=0;i--){
		fanxu=fanxu+sz[i]*(int)pow(10,weishu-i-1)/(int)pow(10,i);
	}
	return fanxu;
}
int main(int argc, char* argv[])
{
	int a,b,c,d,e,f;
	scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
	printf("%d\n%d\n%d\n%d\n%d\n%d\n",reverse(a),reverse(b),reverse(c),reverse(d),reverse(e),reverse(f));
	return 0;
}


int reverse(int num)
{
	int i,a;
		while(1)
		{
			if (num%10==0)
		     num=num/10;
			else
				break;
		}
		while(num>0)
		{

			a=num%10;
			cout<<a;
			num=(num-a)/10;
		}
		cout<<endl;
		return 1;
	}
int main()
{
	int i,num;
	for(i=0;i<=5;i++)
	{
		cin>>num;
		if(num==0)
			cout<<"0"<<endl;
		else
		{
			if (num>0)
				reverse(num);
			else
			{
				cout<<"-";
				reverse(-num);
			}
		}
	}
	return 0;
}


void reverse(int num)
{
	int i,k;
	int j=0;
	int a[1000];
	if(num==0)
		printf("0");
	else if(num>0)
	{
		do
		{
			a[j]=num%10;
			num=num/10;
			j++;
		}
		while(num>0);
		for(i=0;i<j;i++)
		{
			if(a[i]!=0)
				break;
		}
		for(k=i;k<j;k++)
			printf("%d",a[k]);
	}
	else if(num<0)
	{
		num=-num;
		do
		{
			a[j]=num%10;
			num=num/10;
			j++;
		}
		while(num>0);
		for(i=0;i<j;i++)
		{
			if(a[i]!=0)
				break;
		}
		printf("-");
		for(k=i;k<j;k++)
			printf("%d",a[k]);
	}
}

int main()
{
	int x,y;
	for(x=0;x<6;x++)
	{
		scanf("%d",&y);
		reverse(y);
		printf("\n");
	}

	return 0;
}


int reverse(int n);

int main(int argc, char* argv[])
{
	int a[6],b[6];
	int i;

	for(i=0;i<6;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]>=0)
		{
			b[i]=reverse(a[i]);
			printf("%d\n",b[i]);
		}
		else
		{
			b[i]=reverse(-a[i]);
			printf("%d\n",-b[i]);
		}
	}

	return 0;
}

int reverse(int n)
{
	int lenth=0,a,num=0;
	int i;
	int b,c,k;
	double d;

	a=n;
	while(a>=1)
	{
		a=a/10;
		lenth++;
	}
	k=0;
	for(i=lenth;i>0;i--)
	{

		b=n%(int)pow(10,i);
		c=n%(int)pow(10,(i-1));
		d=pow(10,(1-lenth+2*k));
		k++;
		num+=(b-c)*d;
	}

	return num;
}


int reverse(int num)
{
    int a=0;
    if(num>0)
   { do
    {
    a=a*10+num%10;
    num=num/10;
    }
    while(num!=0);
    }
    if(num<0)
   {   num=num*(-1);
    do
    { a=a*10+num%10;
    num=num/10;
    }
    while(num!=0);
    a=a*(-1);
    }
    return a;
}
main()
{
      int a[6],b[6];
      int i;
       for(i=0;i<6;i++)
       {
         scanf("%d",&a[i]);
         b[i]=reverse(a[i]);
         }
       for(i=0;i<6;i++)
       printf("%d\n",b[i]);
       getchar();
       getchar();
}


int main()
{
	int a[6],i,j,b[6],m,n;
	for(i=0;i<6;i++)
		scanf("%d",&a[i]);
	int reverse(int num);
	for(j=0;j<6;j++)
	{
		b[j]=reverse(a[j]);
		printf("%d\n",b[j]);
	}
	return 0;
}
int reverse(int num)
{
	int m,n=0;
	m=num;
	while(num!=0)
	{
		n=n*10+num%10;
		num/=10;
	}
	num=n;
	return(num);
}


int main()
{
    int n,i;
    int reverse(int num);
    for(i=1;i<=6;i++)
    {
                     scanf("%d",&n);
                     printf("%d\n",reverse(n));
    }
    return 0;
}
int reverse(int num)
{
    int x,m,i,s,t,yu,j;

    if(num==0) return 0;
    else{
         if(num>0){
         x=num;
         s=2;
         t=0;
    while(1)
    {
            if(num%10==0) {num=num/10;t++;}
            else
            break;
    }
    while(1)
    {
            if(x/10>9) {s=s+1;x=x/10;}
            else
            {break;}
    }
    s=s-t;
    if(s==1) return num;
    else{
         int result=0;
    for(i=1;i<=s-1;i++)
    {
           yu=num%10;
           num=num/10;
           for(j=1;j<=s-i;j++)
           yu=yu*10;
           result=result+yu;
    }
    result=result+num;
    return result;
    }
}
    if(num<0)
    {
             printf("-");
             num=-num;
              x=num;
         s=2;
         t=0;
    while(1)
    {
            if(num%10==0) {num=num/10;t++;}
            else
            break;
    }
    while(1)
    {
            if(x/10>9) {s=s+1;x=x/10;}
            else
            {break;}
    }
    s=s-t;
    if(s==1) return num;
    else{
         int result=0;
    for(i=1;i<=s-1;i++)
    {
           yu=num%10;
           num=num/10;
           for(j=1;j<=s-i;j++)
           yu=yu*10;
           result=result+yu;
    }
    result=result+num;
    return result;
    }
    }
}
}


int reverse(int num)
{
	int zheng=abs(num);
	int sz[10],i,wei=0;
	for(i=0;i<10;i++){
		sz[i]=zheng%10;
		zheng=zheng/10;
		wei++;
		if(zheng==0)
			break;
	}
	int Reverse=0;
	for(i=0;i<wei;i++){
		Reverse=Reverse*10+sz[i];
	}
	return Reverse;
}
int main()
{
	int n,i;
	for(i=0;i<6;i++){
		scanf("%d",&n);
		if(n>0){
			printf("%d\n",reverse(n));
		}else{
			printf("%d\n",-reverse(n));
		}
		}
	return 0;
}


void reverse( int num);
int main()
{

	int num;
	for(int i=0;i<6;i++)
	{
		cin>>num;
		if(num==0||num==-0)
			cout<<"0";
		else
		{
			reverse(num);
		}
	}
	return 0;
}
void reverse(int num)
{
	int x;
	if (num<0)
	{
		num=0-num;
		cout<<'-';
	}
	if(num!=0)
	{
		if(num%10==0)
		{
			for(;num%10==0;)
				num/=10;
			for(;num!=0;num/=10)
			{
				x=num%10;
				cout<<x;
			}
			cout<<endl;
		}
		else
		{
			for(;num!=0;num/=10)
			{
				x=num%10;
				cout<<x;
			}
			cout<<endl;
		}
	}

}


int reverse(int digit);
int main()
{
	int i;
	int s;
	int t;
	for(i=0;i<6;i++)
	{
		scanf("%d",&s);
		t=reverse(s);
		printf("%d\n",t);
	}

	return 0;
}
int reverse(int digit)
{
	int result;
	int n[MAX],i,count;
	if(digit==0)
		return result=0;
	else if(digit==-0)
		return result=0;
	else if(digit>0)
	{
        i=count=0;
		while(digit>=1)
		{
			n[i]=digit%10;
			digit=digit/10;
			i++;
			count++;
		}
		result=0;
		for(i=0;i<count;i++)
		{
			result+=n[i]*(int)pow((double)10,(count-i-1));
		}
		return result;
	}
	else
	{
		digit=abs(digit);
		i=count=0;
		while(digit>=1)
		{
			n[i]=digit%10;
			digit=digit/10;
			i++;
			count++;
		}
		result=0;
		for(i=0;i<count;i++)
		{
			result+=n[i]*(int)pow((double)10,(count-i-1));
		}
		result=-result;
		return result;
	}
}


int fanxushu(int x)
{
	long j,a,shuzu[10];
	int k,l;
	a=abs(x);
	for(j=0;j<10;j++){
		shuzu[j]=(a%(long)pow(10,j+1))/(long)pow(10,j);
	}
	for(j=0;j<10;j++){
		if(shuzu[j]!=0){
			k=j;
			break;
		}
	}
	for(j=9;j>=0;j--){
		if(shuzu[j]!=0){
			l=j;
			break;
		}
	}
	for(j=0;;j++){
		printf("%d",shuzu[k+j]);
		if(k+j==l){
			break;
		}
	}
	return 0;
}
int main()
{
	int i,shuru;
	for(i=0;i<6;i++){
		scanf("%d",&shuru);
		if(shuru==0){
			printf("0\n");
		}
		if(shuru>0){
			fanxushu(shuru);
			printf("\n");
		}
		if(shuru<0){
			printf("-");
			fanxushu(shuru);
			printf("\n");
		}
	}
	return 0;
}


main()
{
    int i,j[6],k[6];
    int reverse(int n);
    for(i=0;i<6;i++)
    {   scanf("%d",&j[i]);
        k[i]=reverse(j[i]);
        }
    for(i=0;i<6;i++)
        printf("%d\n",k[i]);

    }

     int reverse(int n)
     {      int N,i,j=0,revn=0;
            N=n;
            if(n<0)
            n=-n;
            for(;n!=0;)
            {   j=n%10;
                revn=revn*10+j;
                n=n/10;
                        }
            if(N<0)
            revn=-revn;
            return(revn);

            }


int reverse(int num)
{
	int a,i;
	for(i=0;i<100;i++)       //????????0??
	{
		if(num%10!=0)
			break;
		else
			num=num/10;
	}
	while(num>0)           //????
	{
		a=num%10;
		cout<<a;
		num=num/10;
	}
	cout<<endl;
	return 1;
}
int main()
{
	int num=0,i=0;
	for(i=0;i<6;i++)
	{
		cin>>num;
		if(num==0)           //??0?
			cout<<"0"<<endl;
		else
		{
			if(num>0)
				reverse(num); //????
			else
			{
				cout<<"-";    //????
				reverse(-num);
			}
		}
	}
	return 0;
}


int reverse(int num);
int main()
{
    int sz[6],i;
    for(i=0;i<6;i++)
                    scanf("%d",&sz[i]);
    for(i=0;i<6;i++)
                    reverse(sz[i]);

    return 0;
}

int reverse(int num)
{
     int start=0,temp,value;

     if(num==0)
               printf("0");
     else{
          if(num<0)
                   printf("-");
          value=fabs(num);
          do{
             temp=value%10;
             if(temp!=0)
                        start=1;
             if(start==1)
                         printf("%d",temp);
             value=value/10;
          }while(value>0);
     }
     printf("\n");
     return 0;

}


//????????
//1000012915???
int reverse(int num);

int main()
{
	int Number,i,NUM[7];

	for(i=0;i<6;i++)
	{
		cin>>Number;
		NUM[i]=reverse(Number);
	}

	for(i=0;i<6;i++)cout<<NUM[i]<<endl;

	return 0;
}

int reverse(int num)
{
	int i=0;
	while(num!=0)
	{
		i=i*10+num%10;
		num=num/10;
	};
	return i;

}


int reverse(int num,int a)
{
	a=10*a+num%10;
	if(num>9||num<-9) return (reverse(num/10,a));
	return a;
}

int main()
{
	int num,i;
	for(i=1;i<=6;i++)
	{
		scanf("%d",&num);
		printf("%d\n",reverse(num,0));
	}
		return 0;
}


int MI(int x)
{
    int a,mul=1;
    for(a=0;a<x;a++)
    {
                 mul=mul*10;
    }
    return mul;
}
int reverse(int num)
{
    int a=1,count,i,n,plus=0,c=2,remove;
    for(count=0;a!=0;count++)
    {
                 a=num/MI(count);
    }
    for(i=1;i<=count-1;i++)
    {
                a=num/MI(count-c);
                plus=plus+a*MI(i-1);
                num=num-a*MI(count-c);
                c++;
    }
    return plus;
}
main()
{
      int n[10001],answer[7],i;
      for(i=1;i<=6;i++)
      {
      scanf("%ld",&n[i-1]);
      answer[i-1]=reverse(n[i-1]);
      }
      for(i=1;i<=6;i++)
      printf("%ld\n",answer[i-1]);
      getchar();
      getchar();
}


int reverse(int num)
{
    if(num==0||num==-0)
        return 0;

    int x=abs(num);

    if(num<0)
        printf("-");

    while(x%10==0)
    {
        x/=10;
    }

    while(x!=0)
    {
        printf("%d", x%10);
        x/=10;
    }

    printf("\n");
    return 1;
}

int main()
{
    int num, i;
    for(i=0;i<6;i++)
    {
        scanf("%d", &num);

        if(reverse(num)==0)
            printf("0\n");
    }

    return 0;
}


int reverse(int num);

void main()
{
	int n,t;
	for(t=0;t<6;t++){
		scanf("%d",&n);
		printf("%d\n",reverse(n));
	}
}

int reverse(int num)
{
	int a[10],i,j,output=0;
	for(i=0;i<10;i++){
		a[i]=(int)(num/pow(10,i))%10;
	}
	for(i=9,j=0;i>=0;i--){
		if(a[i]==0){
			j++;
		}
		else break;
	}

	for(i=0;i<10;i++){
		output+=a[i]*pow(10,(9-j-i));
	}
	return output;
}


void reverse ( int number )           //????????
{
	int result=0;
	if (number>0 && number<10)       //????number??????????????
		cout<<number;
	else if (number>=10)             //????number?????????????
	{
		cout<<( number%10 );
		number=number/10;
		reverse ( number );
	}
}

int main()
{
	int number=0,i=0;
	for (i=0;i<6;i++)
	{
		cin>>number;
		if (number==0)               //?????????????
			cout<<number<<endl;
		else if (number>0)
		{
            while (number%10==0)             //??number?????0
	      	number=number/10;
			reverse (number);
			cout<<endl;
		}
		else if (number<0)
		{
			number=number*(-1);
			cout<<"-";
            while (number%10==0)             //??number?????0
	      	number=number/10;
			reverse (number);
			cout<<endl;
		}
	}
	return 0;
}


int reverse(int n)
{
	int i,a=n,b,j,c=n%10;
	for(i=0;;i++)
	{
		a=a/10;
		if(a/10==0)
		break;
	}
	for(j=0;j<=i;j++)
		c=c*10;
	if(n/10!=0)
	    b=reverse(n/10)+c;
	else
		b=n;
	return b;
}
int main()
{
	int n,b;
	while(cin>>n)
	{
	b=reverse(n);
	cout<<b<<endl;
	}
return 0;
}


void main()
{
	int reverse(int num);
	int a,b,c,d,e,f;
	scanf("%d",&a);
	scanf("%d",&b);
	scanf("%d",&c);
	scanf("%d",&d);
	scanf("%d",&e);
	scanf("%d",&f);
	a=reverse(a);
	b=reverse(b);
	c=reverse(c);
	d=reverse(d);
	e=reverse(e);
	f=reverse(f);
	printf("%d\n%d\n%d\n%d\n%d\n%d",a,b,c,d,e,f);
}
    int reverse(int num)
	{
		int w=0,leap=0;
		if(num<0)
		{
			num=0-num;
			leap=1;
		}

		while(num>0)
		{
			w=num%10+10*w;
			num/=10;
		}
		if(leap==1)
		{
			w=0-w;
		}
		return(w);
	}


void main()
{
	int reverse(int num);
	int i,n,c[6];
	for(i=0;i<6;i++)
	{
		scanf("%d",&n);
		c[i]=reverse(n);
	}
	for(i=0;i<6;i++)
		printf("%d\n",c[i]);
}

int reverse(int num)
{
	int t=0,d;
	if(num==0)
		return 0;
	else if(num>0)
	{
		d=num;
		while(d!=0)
		{
			t=t*10+d%10;
			d=d/10;
		}
		return t;
	}
	else
	{
		d=num*(-1);
		while(d!=0)
		{
			t=t*10+d%10;
			d=d/10;
		}
		return -t;
	}
}


main()
{
    int reverse(int n);
    int X;
    int R;
    int i;
    for(i=0;i<=5;i++)
    {
    scanf("%d",&X);
    R=reverse(X);
    printf("%d\n",R);
    }
}

 int reverse(int n)
{
   int r=0,q,N;
   if(n>0)
   {
          while(n>0)
    {
       q=n%10;
       r=r*10+q;
       n=n/10;
    }
    return(r);
   }
   if(n<0)
   {
          while(n<0)
     {
       N=0-n;
       q=N%10;
       r=r*10+q;
       N=N/10;
       n=0-N;
     }
   return(-r);
    }
    if(n==0)
    return(n);
}


int main()
{
	int reverse(int num);
	int i,num,jieguo;
	for(i=1;i<=6;i++)
	{
		scanf("%d",&num);
		jieguo=reverse(num);
		printf("%d\n",jieguo);
	}
	return 0;
}

int reverse(int num)
{
	int a[10000],i=0,j,m=1,M=0;
	if(num<0)
	{
		num=-num;
		while(num>0)
		{
			a[i]=num%10;
			num=num/10;
			i++;
		}
		for(j=0;j<i;j++)
		{
			M=M+a[i-1-j]*m;
			m=m*10;
		}
		num=-M;
	}
	else
	{
		while(num>0)
		{
			a[i]=num%10;
			num=num/10;
			i++;
		}
		for(j=0;j<i;j++)
		{
			M=M+a[i-1-j]*m;
			m=m*10;
		}
		num=M;
	}
	return(num);
}


int main()
{
int a[6];
int i;
int reverse(int num);
for(i=0;i<6;i++)
scanf("%d",&a[i]);
for(i=0;i<6;i++)
printf("%d\n",reverse(a[i]));
return 0;
}
int reverse(int z)
{
int b=0;
if(z>=10||z<=-10)
{
while(z>=10||z<=-10)
	{
        b=b*10+z%10;
		z/=10;
	}
	b=b*10+z;
return (b);
}
else
{
b=z;
return(b);
}
}


main()
{
    int f(int n);
    int a,b;
    for(int i=1;i<=6;i++)
    {
        scanf("%d",&b);
        a=f(b);
        printf("%d\n",a);
    }
}
int f(int n)
{
    int i=0,m,b;
    double a=0;
    m=fabs(n);
    if(m==0)
    {
        return(0);
    }
    else
    {
        while(pow(10,i)<=m)
        {
            i++;
        }
        int k=0;
        while(k<i)
        {
            b=m/pow(10,i-k-1);
            a=a+b*pow(10,k);
            m=m-b*pow(10,i-k-1);
            k++;
        }
        if(n<0)
        return(-a);
        else
        return(a);
    }
}


int main()
{
int n,m,i;
int reverse(int num);
for(i=0;i<6;i++)
     {
         scanf("%d",&n);
         m=reverse(n);
         printf("%d\n",m);
     }
getchar();getchar();getchar();
}
int reverse(int num)
{
int k,p;
p=0;
k=0;
if(num==0)
return(0);
else
     {
          if(num>0)
            {
                if(num<10)
                return(num);
                else
                {
                    while(k==0)
                    {
                       k=num%10;
                        if(k!=0)
                        break;
                       num=num/10;
                    }
                    while(num!=0)
                      {
                         k=num%10;
                         num=num/10;

                                p=p+k;
                                p=10*p;
                      }
                      return(p/10);
                }
            }
           else
           {
               num=-num;
              if(num<10)
                return(num);
                else
                {
                    while(k==0)
                    {
                       k=num%10;
                        if(k!=0)
                        break;
                       num=num/10;
                    }
                    while(num!=0)
                      {
                         k=num%10;
                         num=num/10;

                                p=p+k;
                                p=10*p;
                      }
                      return(-p/10);
                }
            }
     }
}


int main()
{
	int num,i;
	int reverse(int num);
	for(i=1;i<=6;i++){
		scanf("%d",&num);
		printf("%d\n",reverse(num));
	}
	return 0;
}
int reverse(int num)
{
	int t=0,i,zf=1;
	if(num<0){
		num=-num;
		zf=-1;
	}
	for(i=1;;i++){
		t=t*10+num%10;
		if(num<10)break;
		num=num/10;
	}
	t=t*zf;
	return(t);
}


int reverse(int num);
void main()
{
	int a[6],i;
	for(i=0;i<6;i++)scanf("%d",&a[i]);
	for(i=0;i<6;i++)printf("%d\n",reverse(a[i]));
}

int reverse(int num)
{
	int x=0,flag=0;
	if(num<0)
	{
		flag=1;
		num=0-num;
	}
	while(num!=0)
	{
		x=num%10+x*10;
		num=num/10;
	}
	if(flag==1)x=0-x;
	return(x);
}


int main()
{
    void ff(char str[],int x);
    int i,k,fff;
    char str[1000];
    for(fff=1;fff<=6;fff++)
{
      cin.getline(str,100,'\n');
      k=strlen(str);

      int v=0;

      for(i=k-1;i>=0;i--)
           if(str[i]=='0') v++;

           else break;

      if(v==k)
         cout<<0;
      else if(v==k-1&&str[0]=='-')
             cout<<0<<endl;
      else
      {
          for(i=k-1;i>=1;i--)
              if(str[i]=='0'&&str[i-1]=='0')
              {str[i]=0,str[i-1]=0;i--;}
          else if(str[i]=='0'&&str[i-1]!='0')
                {str[i]=0;break;}
          else break;

          k=strlen(str);
          str[k]='a';
          str[k+1]=0;

          if(str[0]!='-')
              ff(str,0);
          else
          {
              cout<<"-";
              for(i=0;i<=k-2;i++)
                 str[i]=str[i+1];
              str[k-1]='a';
              str[k+1]=0;
              ff(str,0);
          }
          cout << endl;
      }
}

  return 0;
}
  void ff(char str[],int x)
{

    if(str[x]!='a')
      {
      x++;
      ff(str,x);
      x--;
      }
    if (str[x]!='a')
        cout<<str[x];
}


int opp(int a)
{
	int num[5],i,j,rev=0;
	for(i=0;a!=0;i++)
	{
		num[i]=a%10;
		a=(a-a%10)/10;
	}
	for(j=0;j<i;j++)
	{
		rev=rev+num[j]*pow(10,i-j-1);
	}
	return rev;
}
int main()
{
	int opp(int a);
	int i;
	for(i=1;i<7;i++)
	{
		int n;
		scanf("%d",&n);
		if(n>=0)
		{
			printf("%d\n",opp(n));
		}
		else
		{
			printf("-%d\n",opp(-n));
		}
	}
	return 0;
}


int main()
{
	int num;
	int i;

int reverse(int num,int s);
	for(i=0;i<6;i++)
	{
		scanf("%d",&num);
		if(num<0)
		{
			num=-num;
			printf("-%d\n",reverse(num,0));
		}
		else
			printf("%d\n",reverse(num,0));
	}
	return 0;
}

int reverse(int num,int s)
{
	s=s*10+num%10;
	if(num>=10)
		return reverse(num/10,s);
	else
		return s;
}


int number(int n)
{
	int a,number=0;
	if(n>=0)
	{
	while(n!=0)
	{
		a=n%10;
		number=number*10+a;
		n=n/10;
	}
	return number;
	}
	if(n<0)
	{
		n=-n;
        while(n!=0)
		{
		 a=n%10;
		 number=number*10+a;
		 n=n/10;
		}
		return -number;
	}

}
void main()
{
	int A[6],i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&A[i]);
	}
	for(i=0;i<6;i++)
	{
		printf("%d\n",number(A[i]));
	}

}


int reserve(int num)
{
int x,y;
y=0;
if(num==0) return 0;
while(num!=0)
{
x=num%10;
y=y*10+x;
num=(num-x)/10;
}
return y;
}
main()
{
int z,i;
for(i=1;i<=6;i++)
{
scanf("%d",&z);
printf("%d\n",reserve(z));
}
}


int main()
{
int a,b,i;
int inverse(int num);
for(i=0;i<6;i++){
   scanf("%d",&a);
   if(a>=0){
   b=inverse(a);
   printf("%d\n",b);
     }else{
           b=inverse(a);
           printf("-%d\n",b);
           }
   }
return 0;
}

int inverse(int num){
    int ge,shi,bai,qian,wan,num2,fu;
    if(num>=0){
              wan=(int)(num/1e4);
              qian=(int)((num-wan*1e4)/1000);
              bai=(int)((num-wan*1e4-qian*1e3)/100);
              shi=(int)((num-wan*1e4-qian*1e3-bai*1e2)/10);
              ge=(int)(num-wan*1e4-qian*1e3-bai*1e2-10*shi);
              if(10000<=num&&num<=99999){
              num2=(int)(wan+10*qian+1e2*bai+1e3*shi+1e4*ge);
                }else{
                      if(1000<=num&&num<=9999){
                        num2=(int)(qian+10*bai+1e2*shi+1e3*ge);
                        }else{
                              if(999>=num&&100<=num){
                                 num2=(int)(ge*1e2+shi*10+bai);
                                 }else{
                                       if(10<=num&&num<=99){
                                         num2=(int)(ge*10+shi);
                                         }else{
                                               num2=ge;
                                               }
                                       }
                              }
                      }
              }else{
              num=0-num;
              wan=(int)(num/1e4);
              qian=(int)((num-wan*1e4)/1000);
              bai=(int)((num-wan*1e4-qian*1e3)/100);
              shi=(int)((num-wan*1e4-qian*1e3-bai*1e2)/10);
              ge=(int)(num-wan*1e4-qian*1e3-bai*1e2-10*shi);
              if(10000<=num&&num<=99999){
              num2=(int)(wan+10*qian+1e2*bai+1e3*shi+1e4*ge);
                }else{
                      if(1000<=num&&num<=9999){
                        num2=(int)(qian+10*bai+1e2*shi+1e3*ge);
                        }else{
                              if(999>=num&&100<=num){
                                 num2=(int)(ge*1e2+shi*10+bai);
                                 }else{
                                       if(10<=num&&num<=99){
                                         num2=(int)(ge*10+shi);
                                         }else{
                                               num2=ge;
                                               }
                                       }
                              }
                      }
                    }
    return (num2);
    }


int reverse(int num);
int main()
{
	int num;        //????
	int i;
	for(i=0;i<6;i++)//????
	{
		cin>>num;
		cout<<reverse(num)<<endl;
	}
	return 0;
}
int reverse(int num)
{
	int change=0;   //change???????
	while(num!=0)
	{
		change=change*10+num%10;
		num/=10;
	}
	return change;
}


int reverse(int num)
{
    if(num==0||num==-0)
        return 0;

    int x=abs(num);
    int i=0, sum=0, sz[100];
    for(;x!=0;x/=10)
    {
        sz[i++] = x%10;
    }

    x=i;
    for(i=0;i<x;i++)
    {
        sum+=sz[i]*pow(10,(x-i-1));
    }

    if(num<0)
        sum=-sum;

    return sum;
}

int main()
{
    int num, i;

    for(i=0;i<6;i++)
    {
        scanf("%d", &num);
        printf("%d\n", reverse(num));
    }

    return 0;
}


int Reverse(int num);
int main()
{
    int i,num;
    for (i=1;i<=6;i++)
     {
       cin>>num; //??
       cout<<Reverse(num)<<endl; //????
     }
return 0;
}
int Reverse(int num)
{
    int width,i,RevNum;
    width=log10((double)(abs(num)))+1;  //????
    i=0;RevNum=0;
    if (num>0)
    {
	    while(num>0)                          //??n????????
	      {i++;
	      RevNum=RevNum+(num % 10)*(int)(pow(10.0,width-i));
	       num=num/10;
	      }
        return(RevNum);
     }
     else if (num<0)
     {
	    num=-num; //??????????????
        while(num>0)                          //??n????????
	      {i++;
	      RevNum=RevNum+(num % 10)*(int)(pow(10.0,width-i));
	       num=num/10;
	      }
        return(-RevNum);
     }
     else if (num==0) return 0;
}


main()
{
int n,s,c,k,i,y,t,l;
int reverse(int num);
int a[8];
for(i=0;i<6;i++)
{
scanf("%d",&n);
//if(n==0) {printf("0");}
l=reverse(n);
printf("%d\n",l);
}
getchar();
getchar();
getchar();
getchar();
}
int reverse(int num)
{
    int n,s,c,k,i,y,t,l;
    int a[8];
   s=num;
  c=1;k=1;t=0;y=0;
 for(int i=0;s!=0;i++)
 {
         s=s/10;
         c=c*10;
         a[i]=(num-s*c)/k;
         k=k*10;
       //printf("%d %d\n",a[i],i);
          t=10*y;
        y=t+a[i];

//printf("%d\n",y);

}
//printf("%d\n",y);
  num=y;
  return(num);
}


int reverse(int num)
{
	int m,b=0,temp=0;
	if(num==0||num==-0)
		m=0;
	else
	{
		if(num<0)
		{
			num=-num;
			temp=1;
		}
		while(num%10==0)
		{
			num=num/10;
		}
		while(num!=0)
        {

			b=b*10+num%10;
		    num=num/10;
		}
		if(temp==0)
			m=b;
		else m=-b;
	}
		return(m);
}

void main()
{
	int n,i;
	for(i=1;i<=6;i++){
		scanf("%d",&n);
		printf("%d\n",reverse(n));}
}


int fx(int n)
{
    int t=0;
    do
    {
        t=t*10+n%10;
        n/=10;
    }
    while(n!=0);
    return t;
}
int ab(int n)
{
    if(n<0)
    return -ab(-n);
    return fx(n);
}
int main()
{
    int i,t;
    scanf("%d",&t);
    printf("%d",ab(t));
    for(i=1;i<=5;i++)
    {
                     scanf("%d",&t);
    printf("\n%d",ab(t));
    }
   // getch();
    return 0;
}


int cifang(int n)
{
    int t=1,i;
    if(n==0)
    return t;
    else
    {
    for(i=n;i>0;i--)
    t=t*10;
    return t;
    }
}
int reverse(int num)
{
    int i,j,count=0,t,total=0;
    int a[500],b[500];

    for(i=0;;i++)
    {
                 t=0;
                 t=num%cifang(i+1);
                 a[i]=t/cifang(i);
                 count++;
                 num=num-a[i]*cifang(i);
                 if(num==0) break;
    }

    for(i=0;i<count;i++)
    total=total+a[i]*cifang(count-i-1);
    if(total==-0)
    return total=0;
    else
    return total;
}
main()
{
      for(int i=6;i>0;i--)
      {
      int n;
      scanf("%d",&n);
      reverse(n);
     printf("%d\n",reverse(n));
     }
      getchar();
      getchar();
}


main()
{
      int reverse(int num);
      int a[6],i;
      for(i=0;i<=5;i++)
      scanf("%d",&a[i]);
      for(i=0;i<=5;i++)
      {
                           if(i==0)
                              printf("%d",reverse(a[i]));
                              else
                              printf("\n%d",reverse(a[i]));
                              }
      getchar();
      getchar();
}
int reverse(int num)
{
    int a=num,x,b=0;
    for(;a!=0;)
    {
           x=a%10;
           a=a/10;
           b=x+b*10;

     }
       return(b);
}


void reverse(char a[10]){
    int i=0,k=0,s=0;
    char b[10];

    if(strcmp(a,"0")==0){
       printf("0\n");return;}

    if(strcmp(a,"-0")==0){
       printf("0\n");return;}

    if(a[0]=='-'){

       printf("-");
       k=1;
    }

    for(i=0;i<strlen(a)-k;++i){
        if(a[strlen(a)-1-i]=='0' && s==0)
           continue;
        else
           s=1;
        b[i]=a[strlen(a)-1-i];
        printf("%c",b[i]);
    }
    printf("\n");
    //printf("reverse: %s\m",b);
}

int main(){
    int i,j,k=0;
    char a[10];
    for(i=0;i<6;++i){
        scanf("%s",a);
        reverse(a);
    }
}


void echo(int n);
int main()
{
    int i,a[10];
	for(i=0;i<6;i++)
	{
        cin>>a[i];
		while(a[i]%10==0)a[i]=a[i]/10;
		if(a[i]>=0)
		echo(a[i]);
		if(a[i]<0)
		{
		cout<<"-";
        echo(-a[i]);
		}
	cout<<endl;
    }

	return 0;
}
void echo(int n)
{
    cout<<n%10;
    n=n/10;
    if(n>0)
    echo(n);

}


int reverse(int num);
int main()
{
	int n;
	while (cin >>n)
	{
	   if (n<0) {cout <<"-";n=-n;}
	   while (n%10==0&&n!=0)
	     n=n/10;
       reverse(n);
	}

	return 0;
}
int reverse(int num)
{
    cout <<num%10;
	if (num/10!=0)
		reverse(num/10);
	else cout <<endl;
	return 0;
}


main()
{
	int reverse(int num);
	int n,i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&n);
		printf("%d\n",reverse(n));
	}

}
int reverse(int num)
{
	int rev=0;
	if(num>=0)
	{
		while(num)
		{
			rev=rev*10+num%10;
			num=num/10;
		}
	}
	else
	{
		int fan=-num;
		while(fan)
		{
			rev=rev*10+fan%10;
			fan=fan/10;
		}
		rev=-rev;
	}
	return rev;
}


int reverse(int num)
{
    int i,j,l,shang;
    i=0;
    shang=1;
    int zhuanhuan[1000];
    int jieguo;
    if(num>0)
    {
       jieguo=0;
       shang=num;
       while(shang!=0)
       {
       zhuanhuan[i]=shang%10;
       shang=shang/10;
       i++;
       }
       j=i;
       for(i=0;i<j;i++)
       {
          for(l=0;l<i;l++)
          {
             zhuanhuan[j-i-1]=zhuanhuan[j-i-1]*10;
          }
          jieguo=jieguo+zhuanhuan[j-i-1];
       }
       return jieguo;
    }
    else if(num==0)
    {
        jieguo=0;
        return jieguo;
    }
    else
    {
      jieguo=0;
       shang=0-num;
       while(shang!=0)
       {
       zhuanhuan[i]=shang%10;
       shang=shang/10;
       i++;
       }
       j=i;
       for(i=0;i<j;i++)
       {
          for(l=0;l<i;l++)
          {
             zhuanhuan[j-i-1]=zhuanhuan[j-i-1]*10;
          }
          jieguo=jieguo+zhuanhuan[j-i-1];
       }

       jieguo=0-jieguo;
       return jieguo;
    }
}

int main()
{
   int a,i;
   int shuru[6];
   int jieguo[6];

   for(i=0;i<6;i++)
   {
      scanf("%d",&shuru[i]);
   }

   for(i=0;i<6;i++)
   {
    jieguo[i]=reverse(shuru[i]);
   }

    for(i=0;i<6;i++)
   {
      printf("%d\n",jieguo[i]);
   }

   getchar();
   getchar();

}


int main ()
{
	void reverse(int num);
	int num,i;
	for(i=1;i<=6;i++)
	{
		scanf("%d",&num);
		if(num>0)
			reverse(num);
		else if(num==0)
			printf("0\n");
		else
		{
			printf("-");
			reverse(-num);
		}
	}
	return 0;
}
void reverse(int num)
{
	int a;
	while(num>0)
	{
		if(num%10==0)
		{
			num/=10;
		}
		else
			break;
	}
	while(num>0)
	{
		printf("%d",num%10);
		num/=10;
	}
	printf("\n");
}


int reverse (int x)
{
	int back=0;
	int i;
	int qiang1,qiang2;// change the type of double->int
	int w; // digit number
	int m=1; // control + or -
	if(x<0)
	{
		m=-1;
		x=-x;
	}
	for(w=0;1;w++)
	{
		if(x/(pow(10,w))<10)
		{
			break;
		}
	}
	for(i=0;i<=w;i++)
	{
		qiang2=(int)pow(10,w-i);
		back+=(x%10)*qiang2;
		x=x/10;
	}
	return back*m;
}

int main()
{
	int a,i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&a);
		printf("%d\n",reverse(a));
	}
	return 0;
}


int reverse(int n)
{
	int j,temp,flag,i,re_n,num[11];
	flag=0;
	i=0;
	while ((n>=10) || (n%10!=0))
	{
		temp=n%10;
		n=n/10;
		if ((flag==0) && (temp!=0) || (flag==1))
		{
			num[i++]=temp;
			flag=1;
		}
	}

	re_n=0;
	for (j=0;j<=i-1;j++) re_n=re_n*10+num[j];
	return(re_n);
}
void main()
{
	int flag,n;
	flag=0;
	while (scanf("%d",&n)==1)
	{
		if (n<0)
		{
			n=n*(-1);
			printf("-");
		}
		printf("%d\n",reverse(n));
	}
}


int reverse(int num);

int main()
{
	int i;
	int temp;
	for (i=0; i<6; i++){
		scanf("%d", &temp);
		printf("%d\n", reverse(temp));
	}

	return 0;
}

int reverse(int num)
{
	int len;
	int sign;
	int out = 0;		// Modified Unsigned
	int i;
	if (num==0) return 0;
	sign = num / abs(num);
	num = abs(num);
	len = (int)log10(num) + 1;
	for (i=0; i<len; i++)
		out += (num/(int)(pow(10, i))%10)*pow(10,len-i-1);
	return sign*out;

}


void main()
{
	int a[6];
	int i;
	int reverse(int num);
	for(i=0;i<6;i++)
		scanf("%d",&a[i]);
    for(i=0;i<6;i++)
	    reverse(a[i]);
}
int reverse(int num)
{
	int indiv,ten,hundred,thousand,ten_thousand;
	int c;
    if(num>0)
	{
		ten_thousand=num/10000;
		thousand=(int)(num-ten_thousand*10000)/1000;
		hundred=(int)(num-ten_thousand*10000-thousand*1000)/100;
		ten=(int)(num-ten_thousand*10000-thousand*1000-hundred*100)/10;
		indiv=(int)(num-ten_thousand*10000-thousand*1000-hundred*100-ten*10);
		if(num>9999)
		{
			c=indiv*10000+ten*1000+hundred*100+thousand*10+ten_thousand;
		    printf("%d\n",c);
		}
		else if(num>999)
		{
			c=indiv*1000+ten*100+hundred*10+thousand;
			printf("%d\n",c);
		}
		else if(num>99)
		{
			c=indiv*100+ten*10+hundred;
			printf("%d\n",c);
		}
		else if(num>9)
		{
			c=indiv*10+ten;
			printf("%d\n",c);
		}
		else
			printf("%d\n",indiv);

	}
	else if(num==0)
		printf("0\n");
	else
	{
		ten_thousand=abs(num)/10000;
		thousand=(int)(abs(num)-ten_thousand*10000)/1000;
		hundred=(int)(abs(num)-ten_thousand*10000-thousand*1000)/100;
		ten=(int)(abs(num)-ten_thousand*10000-thousand*1000-hundred*100)/10;
		indiv=(int)(abs(num)-ten_thousand*10000-thousand*1000-hundred*100-ten*10);
		if(abs(num)>9999)
		{
			c=indiv*10000+ten*1000+hundred*100+thousand*10+ten_thousand;
		    printf("-%d\n",c);
		}
		else if(abs(num)>999)
		{
			c=indiv*1000+ten*100+hundred*10+thousand;
			printf("-%d\n",c);
		}
		else if(abs(num)>99)
		{
			c=indiv*100+ten*10+hundred;
			printf("-%d\n",c);
		}
		else if(abs(num)>9)
		{
			c=indiv*10+ten;
			printf("-%d\n",c);
		}
		else
			printf("-%d\n",indiv);

	}

}


void arc()
{
	char str[10000];
	char str2[10000];
	int a,b=0,c;
	gets(str);
	a=strlen(str);
	if(a==1) putchar(str[0]);
	else
	{
		if(str[0]=='-')
		{
			putchar(str[0]);
					}
		for(c=a-1;;c--)
		{
		    if(str[c]=='0') b++;
			else
			{
				printf("%c",str[c]);
				b++;
				break;
			}
		}
		for(;b<a;b++)
		{

			if(str[a-b-1]!='-') printf("%c",str[a-b-1]);
	    }
	}
	printf("\n");
}
void main()
{
	int i=0;
	for(;i<6;i++) arc();
}


int reverse(int num){
	int fz,w,g,k,t,a;
	fz=0;
	w=0;
	if(num<=0){
		t=-1;
		num=-num;}
	else{t=1;}
		a=num;
	while(num/10>=1){
		w=w+1;
		num=num/10;
	}
	num=a;
	for(k=0;k<=w;k++){
		g=pow(10,w-k);
		fz=fz+(num%10)*g;
		num=num/10;
	}
	return t*fz;
}
int main(){
	int m,i;
	for(i=0;i<6;i++){
		scanf("%d",&m);
		printf("%d\n",reverse(m));
	}
	return 0;
}


int main()
{
    void nixu(int num,int sign);
    int i,num,sign=0;
    for(i=0;i<6;i++)
    {
        cin>>num;
        nixu (num,sign);
        cout<<endl;
    }
    return 0;
}
void nixu(int num,int sign)
{
    int sum[10000],i=0,temp,j;
    if(num==0)
    cout<<0;
    else
    {
         if(num<0)
         {
             num=0-num;
             cout<<'-';
         }
         if(num%10!=0)
         sign=1;
         if(sign!=0)
         cout<<num%10;
         if(num/10!=0)
         {
             nixu (num/10,sign);
         }
    }

}


int main()
{
    void reverse(int num,int flag);
    for(int i=0;i<6;i++)
    {
        int n;
        cin>>n;
        if(n==0){cout<<'0'<<endl;}
        else
        {
            if(n<0){cout<<'-';n*=-1;}
            reverse(n,0);  //?????????
            cout<<endl;
        }
    }
    return 0;
}
void reverse(int num,int flag)  //????,flag????????
{                               //flag=0????????????
    int c;
    c=num%10;
    if(c!=0){cout<<c;flag=1;}
    else if(c==0&&flag==1){cout<<c;}
    if((num/10)!=0)
        reverse(num/10,flag);

}


int main()
{
    int f(int m);
    int count(int m);
    int m[6];
    for(int i=0;i<=5;i++)
    {
        scanf("%d",&m[i]);
    }
    for(int j=0;j<=5;j++)
    {
        printf("%d\n",f(m[j]));
    }
}
int count(int m)
{
    int a=1;
    int i;
    for(i=0;i<=m-1;i++)
    {
        a=a*10;
    }
    return a;
}

int f(int m)
{
    if(m>0)
    {
        int i=1;
        int n=m;
        while(n/10>=1)
        {
            i++;
            n=n/10;
        }
        int *p=(int *)malloc(i*sizeof(int));
        int j;
        for(j=0;j<=i-1;j++)
        {
            p[j]=m-((int)(m/10))*10;
            m=m/10;
        }
        int k,b=0;
        for(k=0;k<=i-1;k++)
        {
            b=b+p[k]*count(i-k-1);
        }
        return b;
    }
    else if(m==0)
    {
        int c=0;
        return c;
    }
    else
    {
        int i=1,q;
        int n=q=-m;
        while(n/10>=1)
        {
            i++;
            n=n/10;
        }
        int *p=(int *)malloc(i*sizeof(int));
        int j;
        for(j=0;j<=i-1;j++)
        {
            p[j]=q-((int)(q/10))*10;
            q=q/10;
        }
        int k,b=0;
        for(k=0;k<=i-1;k++)
        {
            b=b+p[k]*count(i-k-1);
        }
        return -b;
    }

}


int reverse(int num);
int res(int q,int w,int t);
int main(){
	int n[7],n1[7],i;
	char c;
	for(i=1;i<=6;i++){
		scanf("%d",&n[i]);
		if(n[i]<0){
			n1[i]=0-n[i];
			c='-';
		}
		else{
			n1[i]=n[i];
			c='+';
		}
		if(c=='+') printf("%d\n",reverse(n1[i]));
		if(c=='-') printf("-%d\n",reverse(n1[i]));
	}
	scanf("%d",&i);
	return 0;
}
int reverse(int num){
	int j,result;
	for(j=0;;j++){
		if(num/(int)(pow(10,j))==0){
			break;
		}
	}
	result=res(num,j,0);
	return result;
}
int res(int q,int w,int t){
	int e,r;
	e=((int)(q/pow(10,t)))%10;
	r=((int)(q/pow(10,w-t-1)))%10;
	q=q+pow(10,t)*(r-e)+pow(10,w-t-1)*(e-r);
	t++;
	if(t>=w/2) return q;
	q=res(q,w,t);
	return q;
}


int reverse(int num)
{
	int numnew;
	if(num==0)
		return 0;
	else
	{
		if(num>0)
		{
			numnew=0;
			while(num>0)
			{
				numnew=numnew*10+num%10;
				num=num/10;
			}
			return numnew;
		}
		else if(num<0)
		{
			num=-num;
			numnew=0;
			while(num>0)
			{
				numnew=numnew*10+num%10;
				num=num/10;
			}
			return -numnew;
		}
	}
}
int main()
{
	int i,a[6],answer[6];
	for(i=0;i<6;i++)
	{
		cin >>a[i];
		answer[i]=reverse(a[i]);
		cout <<answer[i]<<endl;
	}
	return 0;
}


int rev(int m)
{
char s[1050];
int k=m;
int ans=0;
int i=0;
while (k>0)
{
s[i]=k%10;
k/=10;
i++;
}
i--;
int base=1;
while (s[i]==0) i--;
for (;i>=0;i--)
{
ans+=s[i]*base;
base*=10;
}
return ans;
}
main()
{
for (int kk=1;kk<=6;kk++)
{
int n,m;
scanf("%d",&n);
if (n<0) m=0-n; else m=n;
if (m==0) printf("0\n");
else
{
m=rev(m);
if (n<0)
printf("-");
printf("%d\n",m);
}
}
}


int reverse(int n)
{
	int i,j,d[201],timer=0,neo=0,e=1;
	if(n<0)
		n*=-1;
	do
	{
		timer++;
		d[timer]=n%10;
		n/=10;
	} while(n>0);
	for(i=1;i<=timer;i++)
	{
		for(j=1;j<=timer-i;j++)
		{
			e*=10;
		}
		neo+=d[i]*e;
		e=1;
	}
	return neo;
}
int main()
{
	int n,i;
	for(i=1;i<7;i++)
	{
		scanf("%d",&n);
		if(n<0)
			printf("-");
		printf("%d\n",reverse(n));
	}
	return 0;
}


int main(){
	int reverse(int num);
	int i,num,a;
	for(i=0;i<6;i++){
		scanf("%d",&num);
		a=reverse(num);
		printf("%d\n",a);
	}
	return 0;
}
int reverse(int num){
	int z=0,a,i,j;
	if(num>=0){
		for(i=0;i<10;i++){
			a=num%10;
			num=num/10;
			z=z*10+a;
			if(num==0){
				break;
			}
		}
	}
	else{
		num=-num;
		for(j=0;j<32;j++){
			a=num%10;
			num=num/10;
			z=z*10+a;
			if(num==0){
				break;
			}
		}
		z=-z;
	}
	return z;
}


int main()
{
    void reverse(int num);
    int num,i;
    for(i=0;i<6;i++)
    {
        cin>>num;
        reverse(num);
    }
    return 0;
}

void reverse(int num0)
{
    int num1=0,n=1;
    while(num0/n!=0)
    {n=n*10;}
    for(int i=10;i<=n;i=i*10)
    {
        num1=num1+(num0%i)/(i/10)*(n/i);
        num0=num0-num0%i;
    }
    cout<<num1<<endl;
}


int reverse(int num)
{ int i,j,a[100],m=0,d;
    d=1;
    if(num<0)
 	{
	    num=-num;
        d=0;
    }
	for(i=0;1;i++)
	{
		if(num<10)
	    	break;
		a[i]=num%10;
		num=num/10;
	}
	for(j=0;j<i;j++)
	{
		m+=a[j]*(pow(10,(i-j)));
	}
	m+=num;
	if(d==0)
		return -m;
	else
		return m;
}
int main()
{
 	int i,n,result;
	for(i=0;i<6;i++)
	{
		scanf("%d",&n);
	    result=reverse(n);
        if(i<5)
		printf("%d\n",result);
        else
        printf("%d",result);
	}
	return 0;
}


int main()
{
    int reverse(int num);

    int a[6],b[6],i;
    for(i=0;i<6;i++)
     {scanf("%d",&a[i]);
    b[i] = reverse(a[i]);}
    for(i=0;i<6;i++)
    printf("%d\n",b[i]);
    getchar();
    getchar();
}
int reverse(int num)
{
  int a[100],i,j,z=0,b=1;
    for(i=0;;i++)
     {a[i]=num%10;
      num=num/10;
      if(num==0)
      break;}
      for(j=i;j>=0;j--)
      {z= z+a[j]*b ;
       b=b*10;
       }
    return(z);
}


int reverse(int x);

int main(){
	int i,m;
	for(i=0;i<6;i++)
	{
		scanf("%d",&m);
		m=reverse(m);
		printf("%d\n",m);
	}
	return 0;
}

int reverse(int x){
	int  j,p;
	p=x;
	int q;
	for(j=0;;j++)
	{
		p=p/10;
		if(p==0)
		{
			q=j;
			break;
		}
	}
	p=0;
	for(j=0;j<q+1;j++)
	{
		p+=(x%10)*pow(10,q-j);
		x=x/10;
	}
	return p;
}


void reserve(int a)//??????
{
     int rest,yu;
     yu=a%10;//?????????
     a=a/10;
     if (a>=1)
     {
                 cout<<yu;
                 reserve(a);
     }
     else cout<<yu<<endl;
}
int main()
{
    int input,i;//?????i????
    for(i=0;i<6;i++)
    {
                    cin>>input;
                    if (input<0)
                    {
                                cout<<"-";
                                input=-input;
                    }
                    for(;;)//??????0
                    {
                           if (input%10==0) input=input/10;
                           else break;
                    }
                    reserve(input);
    }
    cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();cin.get();
    return 0;
}


int reverse(int num)
{
	if(num>0)
	{
		int a[10],i,la,sum=0;
		double temp;
		for(i=0;i<=9;i++)
		{
			a[i]=-1;
		}
		for(i=0;i<=9;i++)
		{
			if(num>0)
			{
				a[i]=num%10;
				num=(int)((num-a[i])/10);
			}
		}
		for(i=0;i<=9;i++)
		{
			if(a[i]==-1)
			{
				la=i;
				break;
			}
		}
		for(i=0;i<=la;i++)
		{
			temp=pow(10.00,la-i-1);
			temp=(int)temp;
			sum=(int)(sum+a[i]*temp);
		}
		return sum;
	}
	if(num==0)
	{
		return 0;
	}
	if(num<0)
	{
		num=-num;
		return -reverse(num);
	}

}
int main()
{
	int i,num;
	for(i=1;i<=6;i++)
	{
		cin >> num;
		cout << reverse(num) << endl;
	}
	return 0;
}


int reverse(int p)
{
	int m=0,k;
	k=abs(p);
	if (p!=0)
	{
		while (k!=0)
		{
			m=m*10+k%10;
			k=k/10;
		}
		m=m*(abs(p)/p);
	}
	else m=0;
	return m;
}
int main()
{
	int num,i;
	for (i=0;i<6;i++)
	{
		cin >>num;
		cout <<reverse(num)<<endl;
	}
	return 0;
}


int reverse(int num);
int main()
{
	int a[6],i,z;
	for(i=0;i<6;i++){
	scanf("%d",&a[i]);
	}
	for(i=0;i<6;i++){
	z=reverse(a[i]);
	if(i==0){
	printf("%d",z);
	}else{
	printf("\n%d",z);
	}
	}
	return 0;
}
int reverse(int num){
	int a=0,Num,n,m;
		Num=num;
		if(Num/10==0){
		n=0;
		}else{
		n=0;
		while(n>=0){
		Num=Num/10;
		if(Num==0){
		break;
		}
		n++;
		}
		m=n;
		while(m>=0){
		a+=num%10*pow(10,m);
		num=num/10;
		m--;
		}
		}
	return a;
}


int main()
{
    int reserve(int num);
    int num;
    int b;
    int a[6],i;
    for(i=0;i<=5;i++)
    {
            scanf("%d",&a[i]);
            num=a[i];
            b=reserve(num);
            printf("%d\n",b);
    }
}
    int reserve(int num)
{
    int c,j,n=0,s=0;
    c=num;
    do
    {
            c=c/10;
            n++;
    }
    while(c!=0);
    for(j=1;j<=n;j++)
    {
            c=num;
            c=c/(pow(10,(j-1)));
            c=c%10;
            s=s+c*pow(10,(n-j));
    }
    return(s);
}


int reverse(int num)
{

	int rvs=0,i,j,a[100],numz;
	if(num==0)rvs=0;
	else
	{
		if(num<0)numz=0-num;
		else numz=num;
		for(i=0;;i++)
		{
			a[i]=numz%10;
			numz/=10;
			if(numz<1)break;
		}
		for(j=0;j<i+1;j++)
		{
			rvs*=10;
			rvs+=a[j];
		}
		if(num<0)rvs*=(-1);

	}
	return rvs;
}
int main()
{
	int n,i;
	for(i=0;i<6;i++)
	{
		scanf("%d",&n);
		printf("%d\n",reverse(n));
	}
	return 0;
}


int reverse(int a);
int R(int a);
main()
{
      int i,j,k;
      for(i=1;i<=6;i++)
      {
          scanf("%d",&j);
          k=reverse(j);
          printf("%d\n",k);
      }
}
int R(int a)
{
    int i,b,c=0;
    for(i=1;a>0;i++)
    {
       b=a%10;
       c=c*10+b;
       a=a/10;
     }
    return(c);
}
int reverse(int a)
{
    int c;
    if (a>0)
    c=R(a);
    else if (a<0)
    c=-R(-a);
    else
    c=0;
    return(c);
}


void reverse( int x )
{
	int i , j ;
	char s[10] ;
	if ( x >= 0 )
	{
		sprintf(s , "%d" , x );
		for ( i = sizeof(s)-1 ; i >= 0 ; i --)
		{
			if ( s[i] > '0' && s[i] <= '9')
			{
				for ( j = i ; j >= 0 ; j --)
					printf("%c" , s[j]);
				break ;
			}
		}
	}
	else
	{
		printf("-");
		reverse(-x);
	}
}

int main(int argc, char* argv[])
{
	int i , num ;
	for ( i = 0 ; i < 6 ; i ++)
	{
		scanf("%d", &num);
		reverse(num);
		printf("\n");
	}
	return 0;
}


double i = 0;
int reverse (int n);
int main ()
{
	int  n;
	while (cin >> n)
	{
		if (n == 0)
		{
			cout <<"0"<<endl;
			continue;
		}
		if ( n < 0)
		{
			cout << "-";
			n = -n;
		}

		i = 0;

		cout << reverse (n) << endl;
	}

	return 0;
}

int reverse (int n)
{
	if (n < 10)
		return n;
	int t;
	t = reverse(n/10);
	i++;
	return (n%10) * pow(10.0,i)+ t;
}


int reverse(int num)/*?????????*/
{
	int ws=0/*??*/,new_num=0,i,a=num;
int ten=1;
		while (a>0)
		{
			ws++;
			a=a/10;
		}
	for(i=0;i<ws;i++)
		ten=ten*10;
	i=1;
	ten=ten/10;
	while(ten>0)
	{
		new_num=num/ten*i+new_num;
		num=num%ten;
		i=i*10;
		ten=ten/10;
	}
	return(new_num);
}

void main()
{
	int a[6]={0},i,j;
	for(i=0;i<6;i++)
	{
		scanf("%d",&a[i]);
	}
	for(i=0;i<6;i++)
	{
		if(a[i]<0)  printf("-%d\n",reverse(-a[i]));
		else if(a[i]>0) printf("%d\n",reverse(a[i]));
		else printf("0\n");
	}
}


int f=0;
void reserve(int num)
{
		num=abs(num);
		if((num%10)!=0){
			cout<<num%10;f = 1;
		}
		if(num%10==0&&f==1)
		{
			cout<<"0";
		}
		if(num/10 >0)
		reserve(num/10);

}
int main()
{
	int i,num;
	for(i=0;i<6;i++)
	{
f=0;
cin>>num;
		if(num<0){
		num=0-num;
		cout<<"-";
		}
		reserve(num);
		cout<<endl;
	}
	return 0;
}