#include <bits/stdc++.h>
using namespace std;
int n, m, sg[55][55][55][55];
bool have[55][55], solved[55][55][55][55];
char flag[55][55], st[55][55];
int Rand() { return (rand() << 15) | rand(); }
int Solve(int lx, int rx, int ly, int ry) {
  int i, j, news;
  bool zero;
  set<int> all;
  if (solved[lx][rx][ly][ry]) {
    return sg[lx][rx][ly][ry];
  }
  solved[lx][rx][ly][ry] = true;
  zero = true;
  for (i = lx; i <= rx; i++) {
    for (j = ly; j <= ry; j++)
      if (have[i][j]) {
        zero = false;
        break;
      }
  }
  if (zero) {
    return 0;
  }
  all.clear();
  for (i = lx; i <= rx; i++) {
    for (j = ly; j <= ry; j++)
      if (have[i][j]) {
        if (flag[i][j] == 'L') {
          news = Solve(lx, rx, ly, j - 1) ^ Solve(lx, rx, j + 1, ry);
          all.insert(news);
        } else if (flag[i][j] == 'R') {
          news = Solve(lx, i - 1, ly, ry) ^ Solve(i + 1, rx, ly, ry);
          all.insert(news);
        } else {
          news = Solve(lx, i - 1, ly, j - 1) ^ Solve(i + 1, rx, ly, j - 1) ^
                 Solve(lx, i - 1, j + 1, ry) ^ Solve(i + 1, rx, j + 1, ry);
          all.insert(news);
        }
      }
  }
  for (i = 0; all.find(i) != all.end(); i++)
    ;
  sg[lx][rx][ly][ry] = i;
  return i;
}
int main() {
  int i, j, answer;
  srand((unsigned)time(0));
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%s", st[i] + 1);
  }
  memset(have, false, sizeof(have));
  memset(solved, false, sizeof(solved));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++)
      if ((i + j - 1) & 1) {
        flag[i + m - j][i + j - 1] = st[i][j];
        have[i + m - j][i + j - 1] = true;
      }
  }
  answer = Solve(1, n + m - 1, 1, n + m - 1);
  memset(have, false, sizeof(have));
  memset(solved, false, sizeof(solved));
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++)
      if ((i + j - 1) % 2 == 0) {
        flag[i + m - j][i + j - 1] = st[i][j];
        have[i + m - j][i + j - 1] = true;
      }
  }
  answer ^= Solve(1, n + m - 1, 1, n + m - 1);
  if (answer == 0) {
    printf("LOSE\n");
  } else {
    printf("WIN\n");
  }
  return 0;
}
