#include <bits/stdc++.h>
using namespace std;
const int maxn = 50;
int n, m;
int sg[maxn][maxn][maxn][maxn][2];
char mp[maxn][maxn];
int get_sg(int x1, int y1, int x2, int y2, int op) {
  if (sg[x1][y1][x2][y2][op] != -1) return sg[x1][y1][x2][y2][op];
  int vis[100];
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (((i + j) & 1) != op) continue;
      int x = i - j + m, y = i + j;
      if (x < x1 || x > x2 || y < y1 || y > y2) continue;
      int sgg = 0;
      if (mp[i][j] == 'L') {
        sgg = get_sg(x1, y1, x2, y - 1, op) ^ get_sg(x1, y + 1, x2, y2, op);
      } else if (mp[i][j] == 'R') {
        sgg = get_sg(x1, y1, x - 1, y2, op) ^ get_sg(x + 1, y1, x2, y2, op);
      } else if (mp[i][j] == 'X') {
        sgg = get_sg(x1, y1, x - 1, y - 1, op) ^
              get_sg(x1, y + 1, x - 1, y2, op) ^
              get_sg(x + 1, y1, x2, y - 1, op) ^
              get_sg(x + 1, y + 1, x2, y2, op);
      }
      vis[sgg] = 1;
    }
  }
  for (int i = 0;; i++) {
    if (vis[i] == 0) {
      sg[x1][y1][x2][y2][op] = i;
      return i;
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  memset(sg, -1, sizeof(sg));
  for (int i = 0; i < n; i++) {
    scanf("%s", mp[i]);
  }
  int ans = get_sg(0, 0, n + m - 1, n + m - 1, 0) ^
            get_sg(0, 0, n + m - 1, n + m - 1, 1);
  if (ans)
    printf("WIN\n");
  else
    printf("LOSE\n");
  return 0;
}
