#include <bits/stdc++.h>
using namespace std;
int X, Y;
string board[30];
int dp[50][50][50][50];
int func(int mins, int maxs, int mind, int maxd) {
  int x, y, i;
  if (mins > maxs || mind > maxd) return 0;
  if (dp[mins][maxs][mind][maxd] != -1) return dp[mins][maxs][mind][maxd];
  set<int> g;
  for ((x) = 0; (x) < (int)(X); (x)++)
    for ((y) = 0; (y) < (int)(Y); (y)++) {
      int s = x + y, d = x - y + 20;
      if (s % 2 == mins % 2 && s >= mins && s <= maxs && d >= mind &&
          d <= maxd) {
        if (board[x][y] == 'L') {
          int tmp =
              (func(mins, s - 2, mind, maxd) ^ func(s + 2, maxs, mind, maxd));
          g.insert(tmp);
        } else if (board[x][y] == 'R') {
          int tmp =
              (func(mins, maxs, mind, d - 2) ^ func(mins, maxs, d + 2, maxd));
          g.insert(tmp);
        } else {
          int tmp =
              (func(mins, s - 2, mind, d - 2) ^ func(mins, s - 2, d + 2, maxd) ^
               func(s + 2, maxs, mind, d - 2) ^ func(s + 2, maxs, d + 2, maxd));
          g.insert(tmp);
        }
      }
    }
  for (i = 0;; i++)
    if (g.find(i) == g.end()) break;
  return dp[mins][maxs][mind][maxd] = i;
}
int main(void) {
  int p, i, j, k, l;
  cin >> X >> Y;
  for ((i) = 0; (i) < (int)(X); (i)++) cin >> board[i];
  for ((i) = 0; (i) < (int)(50); (i)++)
    for ((j) = 0; (j) < (int)(50); (j)++)
      for ((k) = 0; (k) < (int)(50); (k)++)
        for ((l) = 0; (l) < (int)(50); (l)++) dp[i][j][k][l] = -1;
  if (func(0, 40, 0, 40) == func(1, 39, 1, 39)) {
    cout << "LOSE" << endl;
  } else {
    cout << "WIN" << endl;
  }
  return 0;
}
