#include <bits/stdc++.h>
using namespace std;
int n, m;
char a[21][21];
int SG[41][41][41][41][2];
int get_SG(int min_x, int max_x, int min_y, int max_y, int type) {
  if (SG[min_x][max_x][min_y][max_y][type] != -1)
    return SG[min_x][max_x][min_y][max_y][type];
  char vis[41] = {0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (((j + i) & 1) != type) continue;
      int _x = i + j, _y = i - j + m;
      if (_x >= min_x && _x < max_x && _y >= min_y && _y < max_y) {
        int g = 0;
        if (a[i][j] == 'L') {
          g = get_SG(min_x, _x, min_y, max_y, type) ^
              get_SG(_x + 1, max_x, min_y, max_y, type);
        } else if (a[i][j] == 'R') {
          g = get_SG(min_x, max_x, min_y, _y, type) ^
              get_SG(min_x, max_x, _y + 1, max_y, type);
        } else {
          g = get_SG(min_x, _x, min_y, _y, type) ^
              get_SG(min_x, _x, _y + 1, max_y, type) ^
              get_SG(_x + 1, max_x, min_y, _y, type) ^
              get_SG(_x + 1, max_x, _y + 1, max_y, type);
        }
        vis[g] = 1;
      }
    }
  }
  for (int i = 0;; i++)
    if (vis[i] == 0) return SG[min_x][max_x][min_y][max_y][type] = i;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", a[i]);
  }
  memset(SG, -1, sizeof(SG));
  int ans =
      get_SG(0, n + m - 1, 0, n + m, 0) ^ get_SG(0, n + m - 1, 0, n + m, 1);
  if (ans)
    puts("WIN");
  else
    puts("LOSE");
  return 0;
}
