#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:16777216")
const long long N = 1000 + 10;
const long long M = 3 * N + 10;
const int64_t MOD = 1000000007;
const long long INF = 1000 * 1000 * 1000 + 100;
vector<int> al[N];
int n, m, v, lastVertex, visitedCount;
char c;
int used[N];
bool debug = false;
void buildGraph() {
  for (int i = 0; i < n; ++i) {
    cin >> c;
    if (c == '<') {
      for (int from = i * m + 1; from < i * m + m; ++from) {
        for (int to = i * m; to < from; ++to) {
          al[from].push_back(to);
        }
      }
    } else {
      for (int from = i * m; from < i * m + m; ++from) {
        for (int to = from + 1; to < i * m + m; ++to) {
          al[from].push_back(to);
        }
      }
    }
  }
  for (int i = 0; i < m; ++i) {
    cin >> c;
    if (c == '^') {
      for (int from = i; from < v; from += m) {
        for (int to = from - m; to >= 0; to -= m) {
          al[from].push_back(to);
        }
      }
    } else {
      for (int from = i; from < v; from += m) {
        for (int to = from + m; to < v; to += m) {
          al[from].push_back(to);
        }
      }
    }
  }
  if (debug) {
    cout << "Graph:\n";
    for (int i = 0; i < v; ++i) {
      cout << i << " => ";
      for (int j = 0; j < al[i].size(); ++j) {
        cout << al[i][j] << ", ";
      }
      cout << endl;
    }
  }
}
void dfs(int u) {
  used[u] = 1;
  visitedCount++;
  for (int i = 0; i < al[u].size(); ++i) {
    if (!used[al[u][i]]) dfs(al[u][i]);
  }
  lastVertex = u;
}
int main(int argc, char* argv[]) {
  cin >> n >> m;
  v = n * m;
  buildGraph();
  for (int u = 0; u < v; ++u) {
    visitedCount = 0;
    lastVertex = 0;
    for (int i = 0; i < v; ++i) used[i] = 0;
    dfs(u);
    if (visitedCount != v) {
      if (debug)
        cout << "Failed on source " << u << ", visitedCount=" << visitedCount
             << endl;
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
