#include <stdio.h>
#include <stdlib.h>

int main()
{
    char ch[2][3];
    int i,j;
    for(i = 0 ; i < 2; i++)
    {
       for(j = 0;j < 3;j++)
       {
           scanf("%c",&ch[i][j]);
       }
    }
    for(i = 0 ; i < 2; i++)
    {
        for(j = 0;j < 3; j++)
        {
              if(ch[2-i][3-j]!=ch[j][i])
                 printf("NO\nThis grid does not remain the same when rotated 180 degrees.\n");
                 return 0;
        }
    }
    printf("YES\nThis grid remains the same when rotated 180 degrees.\n");


}
