#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > v;
int memoria[50][50][50][50];
int nimber(int i1, int j1, int i2, int j2) {
  if (i1 == i2 or j1 == j2) return 0;
  int &m = memoria[i1][j1][i2][j2];
  if (m != -1) return m;
  vector<int> values;
  for (int i = i1 + 1; i < i2; i++) {
    for (int j = j1 + 1; j < j2; j++) {
      if (v[i][j] == 2)
        values.push_back(nimber(i1, j1, i, j2) ^ nimber(i, j1, i2, j2));
      else if (v[i][j] == 1)
        values.push_back(nimber(i1, j1, i2, j) ^ nimber(i1, j, i2, j2));
      else if (v[i][j] == 3)
        values.push_back(nimber(i1, j1, i, j) ^ nimber(i, j, i2, j2) ^
                         nimber(i1, j, i, j2) ^ nimber(i, j1, i2, j));
    }
  }
  sort(values.begin(), values.end());
  if (int(values.size()) == 0 or values[0] != 0)
    m = 0;
  else {
    int ind = 1;
    while (ind < int(values.size()) and (values[ind] == values[ind - 1] or
                                         values[ind] == 1 + values[ind - 1]))
      ind++;
    m = values[ind - 1] + 1;
  }
  return m;
}
void escriu(vector<vector<int> > w) {
  for (int i = 0; i < int(w.size()); i++) {
    vector<int> &u = w[i];
    for (int j = 0; j < int(u.size()); j++) {
      cout << u[j] << ",";
    }
    cout << endl;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> input(n);
  for (int i = 0; i < n; i++) cin >> input[i];
  vector<vector<int> > v1(n + m + 1, vector<int>(n + m + 1, 0));
  vector<vector<int> > v2(n + m + 1, vector<int>(n + m + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int val = 0;
      if (input[i][j] == 'L')
        val = 1;
      else if (input[i][j] == 'R')
        val = 2;
      else
        val = 3;
      if ((i + j) % 2 == 0)
        v1[(1 + i - j + m) / 2][(2 + i + j) / 2] = val;
      else
        v2[(1 + i - j + m) / 2][(2 + i + j) / 2] = val;
    }
  }
  v = v1;
  for (int i1 = 0; i1 < 50; i1++)
    for (int i2 = 0; i2 < 50; i2++)
      for (int i3 = 0; i3 < 50; i3++)
        for (int i4 = 0; i4 < 50; i4++) memoria[i1][i2][i3][i4] = -1;
  int val1 = nimber(0, 0, n + m, n + m);
  v = v2;
  for (int i1 = 0; i1 < 50; i1++)
    for (int i2 = 0; i2 < 50; i2++)
      for (int i3 = 0; i3 < 50; i3++)
        for (int i4 = 0; i4 < 50; i4++) memoria[i1][i2][i3][i4] = -1;
  int val2 = nimber(0, 0, n + m, n + m);
  if ((val1 ^ val2) == 0)
    cout << "LOSE" << endl;
  else
    cout << "WIN" << endl;
}
