#include <bits/stdc++.h>
int n, m, sg[42][42][42][42][2], v[42][42][42][42][2];
char s[42][42];
int deal(int l, int r, int u, int d, int g) {
  int &res = sg[l][r][u][d][g], val;
  long long c = 0;
  if (v[l][r][u][d][g]) return res;
  v[l][r][u][d][g] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (((i + j) & 1) == g) {
        int p = i + j, q = j - i + n;
        if (l <= p && p < r && u <= q && q < d) {
          if (s[i][j] == 'L')
            val = deal(l, p, u, d, g) ^ deal(p + 1, r, u, d, g);
          else if (s[i][j] == 'R')
            val = deal(l, r, u, q, g) ^ deal(l, r, q + 1, d, g);
          else
            val = deal(l, p, u, q, g) ^ deal(p + 1, r, u, q, g) ^
                  deal(l, p, q + 1, d, g) ^ deal(p + 1, r, q + 1, d, g);
          c |= 1ll << val;
        }
      }
  return res = __builtin_ctz(++c);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", s[i]);
  puts(deal(0, n + m, 0, n + m, 0) ^ deal(0, n + m, 0, n + m, 1) ? "WIN"
                                                                 : "LOSE");
}
