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