#include <bits/stdc++.h>
using namespace std;
int v[44][44][44][44][2], f[44][44][44][44][2];
int n, m;
char a[22][22];
int calc(int a1, int a2, int b1, int b2, int e) {
  if (a1 < 0 || b1 < 0 || a2 > n + m || b2 > n + m || a1 > n + m ||
      b1 > n + m || a2 < 0 || b2 < 0)
    return 0;
  if (v[a1][a2][b1][b2][e]) return f[a1][a2][b1][b2][e];
  v[a1][a2][b1][b2][e] = 1;
  set<int> sg;
  for (int x = 0; x < n; ++x)
    for (int y = 0; y < m; ++y) {
      if ((x + y) % 2 != e) continue;
      int i = x + y, j = x - y + m - 1;
      if (a1 <= i && i < a2 && b1 <= j && j < b2) {
        int ls;
        if (a[x][y] == 'R')
          ls = calc(a1, a2, b1, j, e) ^ calc(a1, a2, j + 1, b2, e);
        if (a[x][y] == 'L')
          ls = calc(a1, i, b1, b2, e) ^ calc(i + 1, a2, b1, b2, e);
        if (a[x][y] == 'X')
          ls = calc(a1, i, b1, j, e) ^ calc(a1, i, j + 1, b2, e) ^
               calc(i + 1, a2, b1, j, e) ^ calc(i + 1, a2, j + 1, b2, e);
        sg.insert(ls);
      }
    }
  int ret = 0;
  for (; sg.find(ret) != sg.end(); ret++)
    ;
  return f[a1][a2][b1][b2][e] = ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", a[i]);
  puts(calc(0, n + m, 0, n + m, 0) ^ calc(0, n + m, 0, n + m, 1) ? "WIN"
                                                                 : "LOSE");
}
