#include <bits/stdc++.h>
using namespace std;
int H, W;
vector<vector<char>> c(501, vector<char>(501));
vector<int> s(2);
vector<vector<bool>> b(501, vector<bool>(501, false));
bool b1;
bool DFS(vector<int> s, vector<vector<bool>> &b) {
  vector<int> v1 = {1, 0, -1, 0}, v2 = {0, 1, 0, -1};
  if (s.at(0) < 0 || s.at(0) >= H || s.at(1) < 0 || s.at(1) >= W ||
      c.at(s[0]).at(s[1]) == '#' || b[s[0]][s[1]] == true) {
    return false;
  }
  if (c.at(s[0]).at(s[1]) == 'g') {
    return true;
  }
  b[s[0]][s[1]] = true;
  for (int i = 0; i < 4; i++) {
    if (b1) {
      continue;
    }
    b1 = DFS({s.at(0) + v1.at(i), s.at(1) + v2.at(i)}, b);
  }
  return b1;
}
int main() {
  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> c.at(i).at(j);
      if (c.at(i).at(j) == 's') {
        s.at(0) = i;
        s.at(1) = j;
      }
    }
  }
  bool ans = DFS(s, b);
  if (ans) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
