#include <bits/stdc++.h>
using namespace std;
short n, m;
int nn;
char a[3][23];
bool b[405][405], seen[405];
void dfs(int i) {
  if (seen[i]) return;
  seen[i] = 1;
  for (int j = 1; j <= nn; j++)
    if (b[i][j]) dfs(j);
}
int main() {
  cin >> n >> m;
  nn = n * m;
  for (short i = 0; i < 2; i++) scanf("%s", a[i]);
  for (int i = 1, hold; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      hold = (i - 1) * m + j;
      if (a[0][i - 1] == '>') {
        for (short k = j + 1; k <= m; k++) b[hold][(i - 1) * m + k] = 1;
      } else
        for (short k = j - 1; k > 0; k--) b[hold][(i - 1) * m + k] = 1;
      if (a[1][j - 1] == 'v')
        for (short k = i + 1; k <= n; k++) b[hold][(k - 1) * m + j] = 1;
      else
        for (short k = i - 1; k > 0; k--) b[hold][(k - 1) * m + j] = 1;
    }
  }
  dfs(1);
  for (int i = 1; i <= nn; i++)
    if (!seen[i]) return printf("NO") - 2;
  for (int i = 2; i <= nn; i++) {
    for (int j = 1; j <= nn; j++) seen[j] = 0;
    dfs(i);
    if (!seen[1]) return printf("NO") - 2;
  }
  printf("YES");
  return 0;
}
