#include <bits/stdc++.h>
using namespace std;
const int NR = 55;
int n, m;
int sg[NR][NR][NR][NR][2];
char a[NR][NR];
int mex(bool vis[]) {
  for (int i = 0; ~i; i++) {
    if (!vis[i]) return i;
  }
  return 0;
}
int get_sg(int x1, int y1, int x2, int y2, bool flag) {
  if (x1 > x2 || y1 > y2) return 0;
  if (sg[x1][y1][x2][y2][flag] != -1) return sg[x1][y1][x2][y2][flag];
  bool vis[210];
  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 & 1) - flag) || x < x1 || x > x2 || y < y1 || y > y2)
        continue;
      if (a[i][j] == 'L') {
        int a =
            get_sg(x + 1, y1, x2, y2, flag) ^ get_sg(x1, y1, x - 1, y2, flag);
        vis[a] = 1;
      } else if (a[i][j] == 'R') {
        int a =
            get_sg(x1, y + 1, x2, y2, flag) ^ get_sg(x1, y1, x2, y - 1, flag);
        vis[a] = 1;
      } else {
        int a = get_sg(x + 1, y + 1, x2, y2, flag) ^
                get_sg(x1, y1, x - 1, y - 1, flag);
        int b = get_sg(x + 1, y1, x2, y - 1, flag) ^
                get_sg(x1, y + 1, x - 1, y2, flag);
        vis[a ^ b] = 1;
      }
    }
  }
  return sg[x1][y1][x2][y2][flag] = mex(vis);
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int main() {
  memset(sg, -1, sizeof(sg));
  n = read(), m = read();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf(" %c", &a[i][j]);
    }
  }
  int x = get_sg(1, 1, n + m, n + m, 0) ^ get_sg(1, 1, n + m, n + m, 1);
  if (x)
    puts("WIN");
  else
    puts("LOSE");
  return 0;
}
