#include <bits/stdc++.h>
using namespace std;
int n, m, i, k, sum = 0;
char c;
bool ans = true;
vector<int> g[410];
bool vis[410];
void dfs(int n) {
  vis[n] = true;
  sum++;
  for (auto q : g[n]) {
    if (!vis[q]) dfs(q);
  }
}
int main() {
  cin >> n >> m;
  for (i = 0; i < n; ++i) {
    cin >> c;
    if (c == '>')
      for (k = 0; k < m - 1; ++k) g[k + (i * m)].push_back(k + (i * m) + 1);
    else
      for (k = m - 1; k > 0; --k) g[k + (i * m)].push_back(k + (i * m) - 1);
  }
  for (i = 0; i < m; ++i) {
    cin >> c;
    if (c == 'v')
      for (k = 0; k < n - 1; ++k) g[i + (k * m)].push_back(i + ((k + 1) * m));
    else
      for (k = n - 1; k > 0; --k) g[i + (k * m)].push_back(i + ((k - 1) * m));
  }
  for (i = 0; i < n * m; i++) {
    dfs(i);
    if (sum != n * m) {
      cout << "NO";
      return 0;
    }
    sum = 0;
    memset(vis, false, n * m);
  }
  cout << "YES";
  return 0;
}
