#include <bits/stdc++.h>
using namespace std;
int n, m;
int visited[24][24];
string hori, ver;
void dfs(int i, int j) {
  visited[i][j] = 1;
  if (hori[i] == '>' && j + 1 < m) {
    if (visited[i][j + 1] == 0) {
      dfs(i, j + 1);
    }
  }
  if (hori[i] == '<' && j - 1 >= 0) {
    if (visited[i][j - 1] == 0) dfs(i, j - 1);
  }
  if (ver[j] == 'v' && i + 1 < n) {
    if (visited[i + 1][j] == 0)
      ;
    dfs(i + 1, j);
  }
  if (ver[j] == '^' && i - 1 >= 0) {
    if (visited[i - 1][j] == 0) dfs(i - 1, j);
  }
}
int main() {
  cin >> n >> m;
  cin >> hori >> ver;
  for (int p = 0; p < n; p++) {
    for (int q = 0; q < m; q++) {
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          visited[i][j] = 0;
        }
      }
      dfs(p, q);
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (visited[i][j] != 1) {
            cout << "NO";
            return 0;
          }
        }
      }
    }
  }
  cout << "YES";
  return 0;
}
