#include <bits/stdc++.h>
using namespace std;
int n, m;
string h, v;
int dp[21][21], rdp[21][21];
pair<int, int> dvec(pair<int, int> x, char y) {
  if (y == '>' && x.second + 1 < m)
    return make_pair(x.first, x.second + 1);
  else if (y == '<' && x.second - 1 > -1)
    return make_pair(x.first, x.second - 1);
  else if (y == '^' && x.first - 1 > -1)
    return make_pair(x.first - 1, x.second);
  else if (y == 'v' && x.first + 1 < n)
    return make_pair(x.first + 1, x.second);
  else
    return make_pair(-1, -1);
}
int main() {
  memset(dp, -1, sizeof(dp));
  memset(rdp, -1, sizeof(rdp));
  cin >> n >> m;
  cin >> h >> v;
  stack<pair<int, int> > s;
  s.push(make_pair(0, 0));
  dp[0][0] = rdp[0][0] = 0;
  int time = 0;
  while (!s.empty()) {
    if (dvec(s.top(), h[s.top().first]) != make_pair(-1, -1)) {
      pair<int, int> t = dvec(s.top(), h[s.top().first]);
      if (dp[t.first][t.second] == -1) {
        dp[t.first][t.second] = rdp[t.first][t.second] = ++time;
        s.push(t);
        continue;
      } else
        rdp[s.top().first][s.top().second] =
            min(rdp[s.top().first][s.top().second], rdp[t.first][t.second]);
    }
    if (dvec(s.top(), v[s.top().second]) != make_pair(-1, -1)) {
      pair<int, int> t = dvec(s.top(), v[s.top().second]);
      if (dp[t.first][t.second] == -1) {
        dp[t.first][t.second] = rdp[t.first][t.second] = ++time;
        s.push(t);
        continue;
      } else
        rdp[s.top().first][s.top().second] =
            min(rdp[s.top().first][s.top().second], rdp[t.first][t.second]);
    }
    s.pop();
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (dp[i][j] == rdp[i][j]) ans++;
  if (ans == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
