#include <bits/stdc++.h>
using namespace std;
vector<int> v[1000];
int visit[1000] = {0}, ans = 0;
void dfs(int x) {
  visit[x] = 1;
  ans++;
  for (int i = 0; i < v[x].size(); i++) {
    if (visit[v[x][i]] == 0) {
      dfs(v[x][i]);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  char s[100];
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '>') {
      for (int j = 1; j <= m - 1; j++) {
        v[i * m + j].push_back(i * m + j + 1);
      }
    }
    if (s[i] == '<') {
      for (int j = 1; j <= m - 1; j++) {
        v[i * m + j + 1].push_back(i * m + j);
      }
    }
  }
  cin >> s;
  for (int j = 0; j < m; j++) {
    if (s[j] == 'v') {
      for (int i = 0; i < n - 1; i++) {
        v[i * m + j + 1].push_back((i + 1) * m + j + 1);
      }
    }
    if (s[j] == '^') {
      for (int i = 0; i < n - 1; i++) {
        v[(i + 1) * m + j + 1].push_back(i * m + j + 1);
      }
    }
  }
  for (int i = 1; i <= m * n; i++) {
    ans = 0;
    for (int j = 0; j <= m * n + 5; j++) {
      visit[j] = 0;
    }
    dfs(i);
    if (ans != m * n) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
