#include <bits/stdc++.h>
char str[30][30], c[40][40];
int dp[40][40][40][40];
int pd(int x0, int x1, int y0, int y1) {
  int i, j, t;
  int u[110];
  if (dp[x0][x1][y0][y1] >= 0) return dp[x0][x1][y0][y1];
  memset(u, 0, sizeof(u));
  for (i = x0; i < x1; i++) {
    for (j = y0; j < y1; j++) {
      if (c[i][j] == 'L') {
        t = 0;
        t ^= pd(x0, i, y0, y1);
        t ^= pd(i + 1, x1, y0, y1);
        u[t] = 1;
      } else if (c[i][j] == 'R') {
        t = 0;
        t ^= pd(x0, x1, y0, j);
        t ^= pd(x0, x1, j + 1, y1);
        u[t] = 1;
      } else if (c[i][j] == 'X') {
        t = 0;
        t ^= pd(x0, i, y0, j);
        t ^= pd(i + 1, x1, y0, j);
        t ^= pd(x0, i, j + 1, y1);
        t ^= pd(i + 1, x1, j + 1, y1);
        u[t] = 1;
      }
    }
  }
  for (i = 0; u[i]; i++)
    ;
  return dp[x0][x1][y0][y1] = i;
}
int main() {
  int n, m, i, j, t;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%s", str[i]);
    for (j = 0; j < m; j++) {
      if ((i & 1) == (j & 1)) {
        c[i + j][i - j + m - 1] = str[i][j];
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  t = pd(0, n + m - 1, 0, n + m - 1);
  memset(c, 0, sizeof(c));
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if ((i & 1) != (j & 1)) {
        c[i + j][i - j + m - 1] = str[i][j];
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  t ^= pd(0, n + m - 1, 0, n + m - 1);
  if (t) {
    printf("WIN\n");
  } else {
    printf("LOSE\n");
  }
  return 0;
}
