#include <bits/stdc++.h>
const int INF = 0x3f3f3f3f;
const long long int INFLL = 0x3f3f3f3f3f3f3f3fll;
long long int getint() {
  long long int ret = 0;
  bool f = 0;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') f ^= 1;
  while (c >= '0' && c <= '9') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return f ? -ret : ret;
}
using namespace std;
const int MAXN = 20;
char s[MAXN + 10][MAXN + 10], mp[MAXN + 10][MAXN + 10];
int f[MAXN + 10][MAXN + 10][MAXN + 10][MAXN + 10];
int solve(int u, int l, int d, int r) {
  if (u > d || l > r) return 0;
  int &ret = f[u][l][d][r];
  if (~ret) return ret;
  int a[MAXN * MAXN + 10], top = 0;
  for (int i = u; i <= d; ++i)
    for (int j = l; j <= r; ++j)
      if (mp[i][j]) {
        int t;
        if (mp[i][j] == 'L')
          t = solve(u, l, i - 1, r) ^ solve(i + 1, l, d, r);
        else if (mp[i][j] == 'R')
          t = solve(u, l, d, j - 1) ^ solve(u, j + 1, d, r);
        else
          t = solve(u, l, i - 1, j - 1) ^ solve(u, j + 1, i - 1, r) ^
              solve(i + 1, l, d, j - 1) ^ solve(i + 1, j + 1, d, r);
        a[++top] = t;
      }
  sort(a + 1, a + top + 1);
  top = unique(a + 1, a + top + 1) - a - 1;
  ret = 0;
  for (int i = 1; i <= top && ret == a[i]; ++i, ++ret)
    ;
  return ret;
}
int main() {
  int n = getint(), m = getint();
  for (int i = 1; i <= n; ++i) scanf("%s", s[i] + 1);
  int row = (n + m - 1) / 2, col = m / 2 + n / 2;
  int lst = n & 1 ? n - 2 : n - 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if ((i + j) & 1) mp[(i + j) / 2][(j - i + lst) / 2 + 1] = s[i][j];
  memset(f, -1, sizeof f);
  int SG = solve(1, 1, row, col);
  row = n + m - 1 - row;
  col = m + n - 1 - col;
  lst = n & 1 ? n - 1 : n - 2;
  memset(mp, 0, sizeof mp);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (!((i + j) & 1)) mp[(i + j) / 2][(j - i + lst) / 2 + 1] = s[i][j];
  memset(f, -1, sizeof f);
  SG ^= solve(1, 1, row, col);
  printf(SG ? "WIN\n" : "LOSE\n");
  return 0;
}
