/*------------------------------------------------------------
TEAM27
A
236
Target: MSVC9; Platform: Win32; Comment: MS Visual C++ 9
------------------------------------------------------------*/
#include <algorithm>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <ctime>


using namespace std;

#define white 'w'
#define black 'b'
#define none '.'

#define debug 0
FILE *f;


int color;
                             	
char a[10][10];
int b[10][10];

char px[2][16], py[2][16];
int pn[2];

void outBoard()
{
  for (int i = 8; i >= 1; i--)
    fprintf(f, "%s\n", a[i] + 1);
  fprintf(f, "\n");
}


void setColor( int c )
{
  color = c;
}

void updMove( char *s )
{
  if (color == black)
  {
    s[1] = '1' + '8' - s[1]; 
    s[3] = '1' + '8' - s[3]; 
  }
}


void makeMove( char *s )
{
  a[s[3] - '0'][s[2] - 'a' + 1] = a[s[1] - '0'][s[0] - 'a' + 1];
  a[s[1] - '0'][s[0] - 'a' + 1] = none;
}

void init()
{
  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++)
      a[i][j] = i <= 2 ? white : i >= 7 ? black : none;
}


struct move
{
  char sx, sy, tx, ty;
  int d;
  char i;
};

#define maxDepth 20

move mv[maxDepth][50];
int mvn[maxDepth];

//int co[] = {0, 1, 2, 4, 8, 16, 32, 64, 2048};
int co[] = {0, 1, 4, 9, 16, 25, 36, 49, 2048};

void genMoves( move *m, int &mn, int c, int f = 0 )
{
  mn = 0;
  int t = c == black;
  char *x = px[t], *y = py[t];
  int n = pn[t];
  for (int i = 0; i < n; i++)
    if (a[x[i]][y[i]] == c)
      for (int d = -1; d <= 1; d++)
      {
        int dx = (t ? -1 : +1);
        char dc = (char)(black + white - c);
        char tx = (char)(x[i] + dx);
        char ty = (char)(y[i] + d);

        if (a[tx][ty] && a[tx][ty] != c && ((a[tx][ty] == none) || d))
        {
          if (f == 0)
          {
            if (a[tx][ty] == none && (a[tx + dx][ty + 1] == dc || a[tx + dx][ty - 1] == dc))
              if (d && a[x[i]][y[i] + 2 * d] != c || d == 0 && (a[x[i]][y[i] + 1] != c && a[x[i]][y[i] - 1] != c))
                continue;
          }                           
          int k = t ? 9 - tx : tx;
          m[mn].d =  co[k] - co[k - 1] + (a[tx][ty] == dc ? co[9 - k] : 0);
          m[mn].sx = x[i];
          m[mn].sy = y[i];
          m[mn].tx = tx;
          m[mn].ty = ty;
          m[mn].i = (char)i;
          mn++;
        }

      }
}

bool operator < ( const move &a, const move &b )
{
  return a.d > b.d;
}

int curr;
move bestMove;

int mxD = 5;

long long finish;

int dfs( int cd, int l, int r )
{
  int c = cd % 2;
  genMoves(mv[cd], mvn[cd], (c) ? black : white);

  if (mvn[cd] == 0)
    genMoves(mv[cd], mvn[cd], (c) ? black : white, 1);


  move *m = mv[cd];
  int mn = mvn[cd];

  if (cd == 0)
    bestMove = m[0];

  
  if (clock() > finish)
    return l;
  
  if (cd == mxD)
  {
    int res = -100000;
    for (int i = 0; i < mn; i++)
    {
      if (res < m[i].d)
      {
        res = m[i].d;
//        if (cd == 0)
//          bestMove = m[i];
      }

    }
    return res + curr;
  }

  sort(m, m + mn);

          
//  int tt = -10000;
  for (int i = 0; i < mn; i++)
  {
    char t = a[m[i].tx][m[i].ty];
    a[m[i].tx][m[i].ty] = a[m[i].sx][m[i].sy];
    a[m[i].sx][m[i].sy] = none;
    curr += m[i].d;

    px[c][m[i].i] = m[i].tx;
    py[c][m[i].i] = m[i].ty;

    curr = -curr;
    int x = -dfs(cd + 1, -r, -l);
    curr = -curr;

    px[c][m[i].i] = m[i].sx;
    py[c][m[i].i] = m[i].sy;

    curr -= m[i].d;
    a[m[i].sx][m[i].sy] = a[m[i].tx][m[i].ty];
    a[m[i].tx][m[i].ty] = t;


    if (x > l)
//    if (x > tt)
    {
      l = x;
//      tt = x;
      if (cd == 0)
        bestMove = m[i];
    }

    if (debug)
      if (cd == 0)
      {
        fprintf(f, "%c%c-%c%c : %d\n", m[i].sy + 'a' - 1, m[i].sx + '1' - 1, m[i].ty + 'a' - 1, m[i].tx + '1' - 1, x);
      }

    if (l >= r)
      return l;
  }

//  return tt;
  return l;
} 

void think(char *s)
{
  pn[0] = pn[1] = 0;

  for (int i = 1; i <= 8; i++)
    for (int j = 1; j <= 8; j++)
      if (a[i][j] == white)
      {
        px[0][pn[0]] = (char)i;
        py[0][pn[0]++] = (char)j;
      }
      else if (a[i][j] == black)
      {
        px[1][pn[1]] = (char)i;
        py[1][pn[1]++] = (char)j;
      }
  curr = 0;
  dfs(0, -1024, 1024); 
  s[0] = bestMove.sy + 'a' - 1;
  s[1] = bestMove.sx + '1' - 1;
  s[2] = bestMove.ty + 'a' - 1;
  s[3] = bestMove.tx + '1' - 1;
  s[4] = 0;
}



int main() {

  if (debug)
  {
    f = fopen("log", "w");
  }

  init();
  setColor(black);
  for(;;) {
    char str[100];
    gets(str);
    if(!strcmp(str,"Name")) {
      // Request for the bot name
      printf("DrinkLess\n");
      fflush(stdout);
    }
    else if(!strcmp(str,"Quit")) {
      // Game is over
      break;
    }
    else {
      if(strcmp(str,"Start"))
      {
        updMove(str);
        makeMove(str);
      }
      else
        setColor(white);

      // Our move
      finish = clock() + (long long)(CLOCKS_PER_SEC * 2.8);
      think(str);

      makeMove(str);
      updMove(str);
      printf("%s\n",str);

      if (debug)
      {
        fprintf(f, "%s\n", str);
        outBoard();
        fflush(f);
      }

      fflush(stdout);
    }
  }
  return 0;
}
