#!/usr/bin/perl

while (<>) {
  chomp;
  $foo = lc $_;
  $foo =~ s/[^a-z]//g;
  @letters = split '', $foo;

  foreach (1..$#letters) {
    $l1 = $letters[$_-1];
    $l2 = $letters[$_];
    $l1 = chr(ord($l1)-1) if ($l1 ge 'j');
    $l2 = chr(ord($l2)-1) if ($l2 ge 'j');
    $l1 = ord($l1) - ord('a');
    $l2 = ord($l2) - ord('a');
    $c1 = abs(int($l1/5) - int($l2/5));
    $c1 = 5 - $c1 if ($c1 >= 3);
    $c2 = abs(int($l1%5) - int($l2%5));
    $c2 = 5 - $c2 if ($c2 >= 3);
    if ($c1 == 0 and $c2 == 0) {
      print 'X';
    } elsif ($c1 == 0 or $c2 == 0) {
      print 'R';
    } elsif ($c1 == $c2) {
      print 'B';
    } else {
      print 'N';
    }
  }
  print " $foo\n";

}
