#include <bits/stdc++.h>
using namespace std;
const int maxn = 40 + 5;
char s[maxn][maxn];
int n, m, sg[maxn][maxn][maxn][maxn][2], mex[1000];
int SG(int l1, int r1, int l2, int r2, int flag) {
  if (sg[l1][r1][l2][r2][flag] != -1) return sg[l1][r1][l2][r2][flag];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x = i + j - 1, y = n - i + j;
      if (x < l1 || x > l2 || y < r1 || y > r2 || (x & 1) != flag) continue;
      if (s[i][j] == 'L')
        SG(l1, r1, x - 1, r2, flag), SG(x + 1, r1, l2, r2, flag);
      else if (s[i][j] == 'R')
        SG(l1, y + 1, l2, r2, flag), SG(l1, r1, l2, y - 1, flag);
      else
        SG(l1, r1, x - 1, y - 1, flag), SG(l1, y + 1, x - 1, r2, flag),
            SG(x + 1, r1, l2, y - 1, flag), SG(x + 1, y + 1, l2, r2, flag);
    }
  memset(mex, 0, sizeof(mex));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int x = i + j - 1, y = n - i + j, cur;
      if (x < l1 || x > l2 || y < r1 || y > r2 || (x & 1) != flag) continue;
      if (s[i][j] == 'L')
        cur = sg[l1][r1][x - 1][r2][flag] ^ sg[x + 1][r1][l2][r2][flag];
      else if (s[i][j] == 'R')
        cur = sg[l1][y + 1][l2][r2][flag] ^ sg[l1][r1][l2][y - 1][flag];
      else
        cur = sg[l1][r1][x - 1][y - 1][flag] ^ sg[l1][y + 1][x - 1][r2][flag] ^
              sg[x + 1][r1][l2][y - 1][flag] ^ sg[x + 1][y + 1][l2][r2][flag];
      mex[cur] = 1;
    }
  int cnt = 0;
  while (mex[cnt]) cnt++;
  return sg[l1][r1][l2][r2][flag] = cnt;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  memset(sg, -1, sizeof(sg));
  if (SG(1, 1, m + n - 1, n + m - 1, 0) ^ SG(1, 1, m + n - 1, m + n - 1, 1))
    printf("WIN\n");
  else
    printf("LOSE\n");
  return 0;
}
