#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > graph;
vector<int> used;
void dfs(int v) {
  used[v] = 1;
  for (size_t i = 0; i < graph[v].size(); ++i) {
    int to = graph[v][i];
    if (!used[to]) {
      dfs(to);
    }
  }
  return;
}
int main() {
  cin.tie(NULL);
  std::ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  string s;
  cin >> s;
  graph.resize(3000);
  int i;
  for (i = 0; i < s.length(); ++i) {
    for (int j = 0; j < m; ++j) {
      if (s[i] == '>' && j != m - 1) {
        graph[i * 100 + j].push_back(i * 100 + j + 1);
      }
      if (s[i] == '<' && j != 0) {
        graph[i * 100 + j].push_back(i * 100 + j - 1);
      }
    }
  }
  int j;
  cin >> s;
  for (j = 0; j < s.length(); ++j) {
    for (i = 0; i < n; ++i) {
      if (s[j] == 'v' && i != n - 1) {
        graph[i * 100 + j].push_back((i + 1) * 100 + j);
      }
      if (s[j] == '^' && i != 0) {
        graph[(i)*100 + j].push_back((i - 1) * 100 + j);
      }
    }
  }
  used.resize(3000, 0);
  int check = 1;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      dfs(i * 100 + j);
      for (int ii = 0; ii < n; ++ii) {
        for (int jj = 0; jj < m; ++jj) {
          if (used[ii * 100 + jj] == 0) {
            check = 0;
            break;
          } else {
            used[ii * 100 + jj] = 0;
          }
        }
        if (check == 0) break;
      }
      if (check == 0) break;
    }
    if (check == 0) break;
  }
  if (check == 0) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
  return 0;
}
