#include <bits/stdc++.h>
using namespace std;
long long vis[500003] = {0};
long long vis2[500003] = {0};
vector<long long> adj[500003];
vector<long long> x;
long long ans[500003], color[500003];
long long n, cou, s = 0, s1 = 0;
void dfs(long long k) {
  vis[k] = 1;
  for (long long i = 0; i < adj[k].size(); i++) {
    if (vis[adj[k][i]] == 0) {
      if (color[k] == 1) {
        s++;
        color[adj[k][i]] = 2;
      } else {
        s1++;
        color[adj[k][i]] = 1;
      }
      dfs(adj[k][i]);
    }
  }
}
void dfs2(long long k) {
  vis2[k] = 1;
  ans[k] = cou;
  for (long long i = 0; i < adj[k].size(); i++) {
    if (vis2[adj[k][i]] == 0) {
      dfs2(adj[k][i]);
    }
  }
}
long long p = 998244353;
long long power(long long x, long long y) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n) { return power(n, p - 2); }
int nCrModPFermat(long long n, long long r) {
  if (r == 0) return 1;
  long long fac[n + 1];
  fac[0] = 1;
  for (long long i = 1; i <= n; i++) fac[i] = fac[i - 1] * i % p;
  return (fac[n] * modInverse(fac[r]) % p * modInverse(fac[n - r]) % p) % p;
}
int main() {
  long long n, m, c = 2;
  cin >> n >> m;
  char a[n + 1], b[m + 1], i;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  string ans = "YES";
  if (a[0] == a[n - 1] || b[0] == b[m - 1] || (a[0] == '>' && b[0] == 'v') ||
      (a[0] == '<' && b[m - 1] == 'v') || (a[n - 1] == '>' && b[0] == '^') ||
      (a[n - 1] == '<' && b[m - 1] == '^'))
    ans = "NO";
  cout << ans << endl;
}
