#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long z = 1000000007;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<vector<long long> > v(401);
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = (res * a);
      b--;
    } else {
      a = (a * a);
      b = b >> 1;
    }
  }
  return res;
}
long long c = 0;
void bfs(vector<vector<long long> > v, long long i, long long n) {
  long long vis[n];
  memset(vis, 0, sizeof(vis));
  queue<long long> q;
  q.push(i);
  while (!q.empty()) {
    long long a = q.front();
    q.pop();
    vis[a] = 1;
    for (long long j = 0; j < v[a].size(); j++) {
      if (!vis[v[a][j]]) {
        vis[v[a][j]] = 1;
        q.push(v[a][j]);
      }
    }
  }
  for (long long i = 0; i < n; i++) {
    if (vis[i] == 0) {
      c++;
      break;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    string rw, cl;
    cin >> rw >> cl;
    map<pair<long long, long long>, long long> m1;
    long long k = 0;
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        m1[make_pair(i, j)] = k;
        k++;
      }
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < m; j++) {
        if (rw[i] == '>') {
          if (j + 1 < m)
            v[m1[make_pair(i, j)]].push_back(m1[make_pair(i, j + 1)]);
        } else if (rw[i] == '<') {
          if (j - 1 >= 0)
            v[m1[make_pair(i, j)]].push_back(m1[make_pair(i, j - 1)]);
        }
      }
    }
    for (long long j = 0; j < m; j++) {
      for (long long i = 0; i < n; i++) {
        if (cl[j] == '^') {
          if (i - 1 >= 0)
            v[m1[make_pair(i, j)]].push_back(m1[make_pair(i - 1, j)]);
        } else if (cl[j] == 'v') {
          if (i + 1 < n)
            v[m1[make_pair(i, j)]].push_back(m1[make_pair(i + 1, j)]);
        }
      }
    }
    for (long long i = 0; i < n * m; i++) {
      bfs(v, i, n * m);
      if (c) break;
    }
    if (c)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
