#include <bits/stdc++.h>
using namespace std;
const int N = 45;
int n, m;
char s[N][N];
int sg[N][N][N][N][2];
int dfs(int x1, int y1, int x2, int y2, int d) {
  int &g = sg[x1][y1][x2][y2][d];
  if (g != -1) return g;
  int mex[N * 2] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (((i + j) & 1) == d) {
        int x = i - j + m, y = i + j;
        if (x >= x1 && x <= x2 && y >= y1 && y <= y2) {
          int tmp;
          if (s[i][j] == 'L') {
            tmp = dfs(x1, y1, x2, y - 1, d) ^ dfs(x1, y + 1, x2, y2, d);
          } else if (s[i][j] == 'R') {
            tmp = dfs(x1, y1, x - 1, y2, d) ^ dfs(x + 1, y1, x2, y2, d);
          } else {
            tmp = dfs(x1, y1, x - 1, y - 1, d) ^ dfs(x1, y + 1, x - 1, y2, d) ^
                  dfs(x + 1, y1, x2, y - 1, d) ^ dfs(x + 1, y + 1, x2, y2, d);
          }
          mex[tmp] = 1;
        }
      }
    }
  }
  while (mex[++g])
    ;
  return g;
}
int main() {
  while (~scanf("%d %d", &n, &m)) {
    memset(sg, -1, sizeof(sg));
    for (int i = 0; i < n; i++) scanf("%s", s[i]);
    if (dfs(0, 0, n + m - 1, n + m - 1, 1) ^ dfs(0, 0, n + m - 1, n + m - 1, 0))
      printf("WIN\n");
    else
      printf("LOSE\n");
  }
  return 0;
}
