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