#include <bits/stdc++.h>
long long Max(long long x, long long y) { return x > y ? x : y; }
long long Min(long long x, long long y) { return x < y ? x : y; }
int h, w;
int map[502][502], chk[502][502] = {0}, flag = 0;
void dfs(int x, int y) {
  if (map[x][y] == 3) {
    flag = 1;
  }
  if (map[x][y] == 1) {
    return;
  }
  if (chk[x][y] == 1) {
    return;
  }
  chk[x][y] = 1;
  dfs(x + 1, y);
  dfs(x - 1, y);
  dfs(x, y + 1);
  dfs(x, y - 1);
}
int main() {
  int sx, sy;
  scanf("%d%d", &h, &w);
  for (int i = 0; i <= w + 1; i++) {
    map[0][i] = 1;
    map[h + 1][i] = 1;
  }
  for (int i = 0; i <= h + 1; i++) {
    map[i][0] = 1;
    map[i][w + 1] = 1;
  }
  for (int i = 1; i < h + 1; i++) {
    char tmp[502];
    scanf("%s", tmp);
    for (int j = 0; j < w; j++) {
      if (tmp[j] == 's') {
        map[i][j + 1] = 2;
        sx = j + 1;
        sy = i;
      } else if (tmp[j] == 'g') {
        map[i][j + 1] = 3;
      } else if (tmp[j] == '#') {
        map[i][j + 1] = 1;
      } else {
        map[i][j + 1] = 0;
      }
    }
  }
  dfs(sx, sy);
  if (flag == 1) {
    printf("Yes");
  } else {
    printf("No");
  }
  return 0;
}
