#include <bits/stdc++.h>
const int maxn = 22;
int n, m, typ = 0;
char ms[maxn][maxn];
std::map<unsigned, int> mem;
std::map<long long, int> l2;
inline int solve(int a, int b, int c, int d) {
  unsigned state = ((a + maxn + maxn) << 0) | ((b + maxn + maxn) << 8) |
                   ((c + maxn + maxn) << 16) | ((d + maxn + maxn) << 24);
  if (mem.count(state)) return mem[state];
  long long filled = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (((i ^ j) & 1) == typ && a < i + j && i + j < b && c < i - j &&
          i - j < d) {
        if (ms[i][j] == 'L')
          filled |= 1ll << (solve(a, i + j, c, d) ^ solve(i + j, b, c, d));
        else if (ms[i][j] == 'R')
          filled |= 1ll << (solve(a, b, c, i - j) ^ solve(a, b, i - j, d));
        else
          filled |=
              1ll << (solve(a, i + j, c, i - j) ^ solve(a, i + j, i - j, d) ^
                      solve(i + j, b, c, i - j) ^ solve(i + j, b, i - j, d));
      }
  filled = ~filled;
  return mem[state] = l2[filled & -filled];
}
int main() {
  std::cin >> n >> m;
  for (int i = 0; i < n + m; i++) l2[1ll << i] = i;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) std::cin >> ms[i][j];
  int ans = solve(-maxn - maxn, maxn + maxn, -maxn - maxn, maxn + maxn);
  mem.clear();
  typ = 1;
  puts(ans == solve(-maxn - maxn, maxn + maxn, -maxn - maxn, maxn + maxn)
           ? "LOSE"
           : "WIN");
}
