#include <bits/stdc++.h>
using namespace std;
char ch, s[22][22];
int n, m, N, sg[22][22][22][22], op[22][22];
bool ok, bo[100000];
void read(int &x) {
  for (ok = 0, ch = getchar(); !isdigit(ch); ch = getchar())
    if (ch == '-') ok = 1;
  for (x = 0; isdigit(ch); x = x * 10 + ch - '0', ch = getchar())
    ;
  if (ok) x = -x;
}
int calc(int a, int b, int c, int d) {
  if (a > b || c > d) return 0;
  if (sg[a][b][c][d] != -1) return sg[a][b][c][d];
  for (int i = a; i <= b; i++)
    for (int j = c; j <= d; j++)
      if (op[i][j] == 1)
        calc(a, b, c, j - 1), calc(a, b, j + 1, d);
      else if (op[i][j] == 2)
        calc(a, i - 1, c, d), calc(i + 1, b, c, d);
      else if (op[i][j] == 3)
        calc(a, i - 1, c, j - 1), calc(a, i - 1, j + 1, d),
            calc(i + 1, b, c, j - 1), calc(i + 1, b, j + 1, d);
  for (int i = a; i <= b; i++)
    for (int j = c; j <= d; j++)
      if (op[i][j] == 1)
        bo[calc(a, b, c, j - 1) ^ calc(a, b, j + 1, d)] = 1;
      else if (op[i][j] == 2)
        bo[calc(a, i - 1, c, d) ^ calc(i + 1, b, c, d)] = 1;
      else if (op[i][j] == 3)
        bo[calc(a, i - 1, c, j - 1) ^ calc(a, i - 1, j + 1, d) ^
           calc(i + 1, b, c, j - 1) ^ calc(i + 1, b, j + 1, d)] = 1;
  for (int i = 0;; i++)
    if (!bo[i]) {
      sg[a][b][c][d] = i;
      break;
    }
  for (int i = a; i <= b; i++)
    for (int j = c; j <= d; j++)
      if (op[i][j] == 1)
        bo[calc(a, b, c, j - 1) ^ calc(a, b, j + 1, d)] = 0;
      else if (op[i][j] == 2)
        bo[calc(a, i - 1, c, d) ^ calc(i + 1, b, c, d)] = 0;
      else if (op[i][j] == 3)
        bo[calc(a, i - 1, c, j - 1) ^ calc(a, i - 1, j + 1, d) ^
           calc(i + 1, b, c, j - 1) ^ calc(i + 1, b, j + 1, d)] = 0;
  return sg[a][b][c][d];
}
int solve(int p) {
  memset(op, 0, sizeof(op));
  memset(sg, -1, sizeof(sg));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (((i + j) & 1) == p) {
        op[(i - j + m + 1) >> 1][(i + j) >> 1] = s[i][j] == 'L'   ? 1
                                                 : s[i][j] == 'R' ? 2
                                                                  : 3;
      }
  int t = calc(1, N, 1, N);
  return t;
}
int main() {
  read(n), read(m), N = (n + m) >> 1;
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  puts(solve(0) ^ solve(1) ? "WIN" : "LOSE");
  return 0;
}
