#include <bits/stdc++.h>
using namespace std;
const int N = 21;
const int TN = 4 * N * N + 20;
int zz[TN];
char mm[TN][TN], mme[TN][TN], mmo[TN][TN];
int n, m;
int sg[N << 1][N << 1][N << 1][N << 1];
int cal(int x1, int x2, int y1, int y2, char mm2[][TN]) {
  if (x1 > x2 || y1 > y2) return 0;
  auto &ele = sg[x1][x2][y1][y2];
  if (ele != -1) return ele;
  unordered_set<int> zy;
  for (int row = x1; row <= x2; row++) {
    for (int col = y1; col <= y2; col++) {
      char c = mm2[row][col];
      if (c != 'T') {
        int val = 0;
        if (c == 'L') {
          val ^= cal(x1, x2, y1, col - 1, mm2);
          val ^= cal(x1, x2, col + 1, y2, mm2);
        } else if (c == 'R') {
          val ^= cal(x1, row - 1, y1, y2, mm2);
          val ^= cal(row + 1, x2, y1, y2, mm2);
        } else {
          val ^= cal(x1, row - 1, y1, col - 1, mm2);
          val ^= cal(x1, row - 1, col + 1, y2, mm2);
          val ^= cal(row + 1, x2, y1, col - 1, mm2);
          val ^= cal(row + 1, x2, col + 1, y2, mm2);
        }
        zy.insert(val);
      }
    }
  }
  if (zy.size() == 0) {
    return ele = 0;
  } else {
    int val = 0;
    while (zy.find(val) != zy.end()) val++;
    return ele = val;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", mm[i]);
  int emi = INT_MAX, omi = INT_MAX;
  int emxr = INT_MIN, omxr = INT_MIN, emxc = INT_MIN, omxc = INT_MIN;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if ((i + j) % 2 == 0) {
        emi = min(emi, i - j);
      } else {
        omi = min(omi, i - j);
      }
    }
  }
  int zn = TN;
  for (int i = 0; i < zn; i++)
    for (int j = 0; j < zn; j++) mme[i][j] = mmo[i][j] = 'T';
  int ecbase = 0, ocbase = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int col = i + j, row = i - j;
      if ((i + j) % 2 == 0) {
        col = (col - ecbase) / 2;
        row = (row - emi) / 2;
        emxr = max(emxr, row), emxc = max(emxc, col);
        mme[row][col] = mm[i][j];
      } else {
        col = (col - ocbase) / 2;
        row = (row - omi) / 2;
        omxr = max(omxr, row), omxc = max(omxc, col);
        mmo[row][col] = mm[i][j];
      }
    }
  }
  memset(sg, -1, sizeof(sg));
  int t1 = cal(0, emxr, 0, emxc, mme);
  memset(sg, -1, sizeof(sg));
  int t2 = cal(0, omxr, 0, omxc, mmo);
  int ans = t1 ^ t2;
  if (!ans)
    printf("LOSE\n");
  else
    printf("WIN\n");
  return 0;
}
