#include <bits/stdc++.h>
using namespace std;
const int MAXN = 555;
int n, m;
inline int id(const int& r, const int& c) { return (r - 1) * m + c; }
vector<int> graph[MAXN];
void add_edge(int u, int v) { graph[u].push_back(v); }
int t = 0, _c;
int dt[MAXN], lw[MAXN];
bool on_stack[MAXN];
stack<int> stk;
void scc(int node) {
  dt[node] = lw[node] = ++t;
  stk.push(node);
  on_stack[node] = true;
  for (int nnode : graph[node]) {
    if (!lw[nnode]) {
      scc(nnode);
      lw[node] = min(lw[node], lw[nnode]);
    } else if (on_stack[nnode])
      lw[node] = min(lw[node], dt[nnode]);
  }
  if (dt[node] == lw[node]) {
    ++_c;
    int u;
    while (stk.top() != node) {
      u = stk.top();
      stk.pop();
      on_stack[u] = false;
    }
    u = stk.top();
    stk.pop();
    on_stack[u] = false;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = (1); i <= (n); ++i) {
    char dir;
    cin >> dir;
    if (dir == '>')
      for (int j = (2); j <= (m); ++j) add_edge(id(i, j - 1), id(i, j));
    else
      for (int j = (m - 1); j >= (1); --j) add_edge(id(i, j + 1), id(i, j));
  }
  for (int i = (1); i <= (m); ++i) {
    char dir;
    cin >> dir;
    if (dir == 'v')
      for (int j = (2); j <= (n); ++j) add_edge(id(j - 1, i), id(j, i));
    else
      for (int j = (n - 1); j >= (1); --j) add_edge(id(j + 1, i), id(j, i));
  }
  for (int i = (1); i <= (n * m); ++i)
    if (!lw[i]) scc(i);
  if (_c == 1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
