#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
using ll = long long;
struct edge {
  int f, to, w, next;
} e[maxn << 1];
int head[maxn], cnt;
void add(int u, int v, int w) {
  e[++cnt].next = head[u];
  e[cnt].f = u;
  e[cnt].to = v;
  e[cnt].w = w;
  head[u] = cnt;
}
int mp[505][505];
char r[25], c[25];
int main() {
  int n, m, cur = 0;
  scanf("%d%d", &n, &m);
  scanf("%s%s", r + 1, c + 1);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cur++;
      if (r[i] == '>' && j != m) mp[cur][cur + 1] = 1;
      if (r[i] == '<' && j != m) mp[cur + 1][cur] = 1;
      if (c[j] == 'v' && i != n) mp[cur][cur + m] = 1;
      if (c[j] == '^' && i != n) mp[cur + m][cur] = 1;
    }
  }
  for (int k = 1; k <= cur; ++k) {
    for (int i = 1; i <= cur; ++i) {
      for (int j = 1; j <= cur; ++j) {
        mp[i][j] |= mp[i][k] && mp[k][j];
      }
    }
  }
  bool ok = 1;
  for (int i = 1; i <= cur; ++i) {
    for (int j = 1; j <= cur; ++j) {
      if (!mp[i][j]) {
        ok = 0;
        break;
      }
    }
  }
  if (ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
