def main(x):
    matrix = []
    exit_path = []
    for i in range(0, x):
        j = list(input())
        if ('e' in j):
            y = j.index('e')
            exit_path.append(i)
            exit_path.append(y)
            j[y] = '-'
        matrix.append(j)
    (row, col) = (0, 0)
    matrix[row][col] = 'S'
    path = []
    searching_path(matrix, path, exit_path, row, col)
def main(x):
    matrix = []
    exit_path = []
    for i in range(0, x):
        j = list(input())
        if ('e' in j):
            y = j.index('e')
            exit_path.append(i)
            exit_path.append(y)
            j[y] = '-'
        matrix.append(j)
    (row, col) = (0, 0)
    matrix[row][col] = 'S'
    path = []
    searching_path(matrix, path, exit_path, row, col)