#include <bits/stdc++.h>
using namespace std;
char s[210][210];
int f[50][50][50][50];
int n, m, o;
int ff(int x0, int x1, int y0, int y1) {
  int &ret = f[x0][x1][y0][y1];
  if (ret != -1) return ret;
  set<int> sg;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (((i + j) & 1) == o) {
        int x = i + j, y = i - j + 20;
        if (x0 <= x && x <= x1 && y0 <= y && y <= y1) {
          if (s[i][j] == 'R')
            sg.insert(ff(x0, x1, y0, y - 1) ^ ff(x0, x1, y + 1, y1));
          else if (s[i][j] == 'L')
            sg.insert(ff(x0, x - 1, y0, y1) ^ ff(x + 1, x1, y0, y1));
          else
            sg.insert(ff(x0, x - 1, y0, y - 1) ^ ff(x0, x - 1, y + 1, y1) ^
                      ff(x + 1, x1, y0, y - 1) ^ ff(x + 1, x1, y + 1, y1));
        }
      }
  ret = 0;
  while (sg.count(ret)) ret++;
  return ret;
}
int solve(int o2) {
  o = o2;
  memset(f, -1, sizeof(f));
  return ff(1, n + m, 1, n - 1 + 20);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  if (solve(0) ^ solve(1))
    printf("WIN\n");
  else
    printf("LOSE\n");
  return 0;
}
