/*
* 解题思路:
* 题意容易理解,可以画图分析,发现只要对立面都匹配就为True!
*/
#include <stdio.h>
#include <string.h>
int vis[ 15 ];
char s1[ 8 ],s2[ 8 ];
int compare( int x , int y ,int a,int b,int c,int d )
{
if( !vis[ x ] && !vis[ y ] && ((s2[ x ] == s1[ x ] && s2[ y ] == s1[ y ] ) || (s2[ y ] == s1[ x ] && s2[ x ] == s1[ y ] )) )
{
vis[ x ] = vis[ y ] = 1;
return 1;
}
else if( !vis[ a ] && !vis[ b ] && (( s2[ a ] == s1[ x ] && s2[ b ] == s1[ y ]) || ( s2[ b ] == s1[ x ] && s2[ a ] == s1[ y ])) )
{
vis[ a ] = vis[ b ] = 1;
return 1;
}
else if( !vis[ c ] && !vis[ d ] && ((s2[ c ] == s1[ x ] && s2[ d ] == s1[ y ] ) || (s2[ d ] == s1[ x ] && s2[ c ] == s1[ y ] )) )
{
vis[ c ] = vis[ d ] = 1;
return 1;
}
return 0;
}
int main( )
{
int i;
int sum;
while( ~scanf("%c%c%c%c%c%c%c%c%c%c%c%c",&s1[0],&s1[1],&s1[2],&s1[3],&s1[4],&s1[5],&s2[0],&s2[1],&s2[2],&s2[3],&s2[4],&s2[5]) )
{
getchar( );
sum = 0;
memset(vis,0,sizeof(vis));
sum += compare( 0 , 5 , 1 , 4 , 2 , 3 );
sum += compare( 1 , 4 , 0 , 5 , 2 , 3 );
sum += compare( 2 , 3 , 1 , 4 , 0 , 5 );
if( sum == 3 )
printf("TRUE\n");
else
printf("FALSE\n");
}
return 0;
}