#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l;
bool vis[100][100];
int d[100][100][2];
void dfs(int x, int y) {
  if (x < 0 || x >= n || y < 0 || y >= m || vis[x][y] == 1) return;
  vis[x][y] = 1;
  dfs(x, y + d[x][y][1]);
  dfs(x + d[x][y][0], y);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  string x;
  cin >> x;
  for (i = 0; i < n; i++) {
    int dt;
    if (x[i] == '>')
      dt = 1;
    else
      dt = -1;
    for (j = 0; j < m; j++) {
      d[i][j][1] = dt;
    }
  }
  cin >> x;
  for (j = 0; j < m; j++) {
    int dt;
    if (x[j] == 'v')
      dt = 1;
    else
      dt = -1;
    for (i = 0; i < n; i++) {
      d[i][j][0] = dt;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      memset(vis, 0, sizeof(vis));
      dfs(i, j);
      for (k = 0; k < n; k++) {
        for (l = 0; l < m; l++) {
          if (vis[k][l] == 0) {
            cout << "NO";
            return 0;
          }
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
