#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int n, m, SG[55][55][55][55][2];
char mp[55][55];
int dfs(int x1, int y1, int x2, int y2, int type) {
  if (x1 > x2 || y1 > y2) return 0;
  if (SG[x1][y1][x2][y2][type] != -1) return SG[x1][y1][x2][y2][type];
  bool vis[215];
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int x = i + j, y = i - j + m;
      if ((i + j) % 2 == type || x < x1 || x > x2 || y < y1 || y > y2) continue;
      int nxt = 0;
      if (mp[i][j] == 'L')
        nxt = dfs(x + 1, y1, x2, y2, type) ^ dfs(x1, y1, x - 1, y2, type);
      else if (mp[i][j] == 'R')
        nxt = dfs(x1, y + 1, x2, y2, type) ^ dfs(x1, y1, x2, y - 1, type);
      else
        nxt = dfs(x + 1, y + 1, x2, y2, type) ^
              dfs(x1, y1, x - 1, y - 1, type) ^
              dfs(x + 1, y1, x2, y - 1, type) ^ dfs(x1, y + 1, x - 1, y2, type);
      vis[nxt] = 1;
    }
  }
  int res = 0;
  while (vis[res]) ++res;
  return SG[x1][y1][x2][y2][type] = res;
}
int main() {
  memset(SG, -1, sizeof(SG));
  n = read();
  m = read();
  for (int i = 1; i <= n; i++) scanf("%s", (mp[i] + 1));
  int ans = (dfs(1, 1, n + m, n + m, 0) ^ dfs(1, 1, n + m, n + m, 1));
  if (ans)
    puts("WIN");
  else
    puts("LOSE");
}
