#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  char s[22];
  vector<int> graph[401];
  scanf("%d %d", &n, &m);
  scanf("%s", s);
  for (int i = 0; i < n; i++) {
    if (s[i] == '>')
      for (int j = 0; j < m; j++)
        for (int k = j + 1; k < m; k++) graph[m * i + j].push_back(m * i + k);
    else
      for (int j = m - 1; j >= 0; j--)
        for (int k = j - 1; k >= 0; k--) graph[m * i + j].push_back(m * i + k);
  }
  scanf("%s", s);
  for (int i = 0; i < m; i++) {
    if (s[i] == 'v')
      for (int j = 0; j < n; j++)
        for (int k = j + 1; k < n; k++) graph[m * j + i].push_back(m * k + i);
    else
      for (int j = n - 1; j >= 0; j--)
        for (int k = j - 1; k >= 0; k--) graph[m * j + i].push_back(m * k + i);
  }
  for (int start = 0; start < m * n; start++) {
    bool vis[401] = {};
    vis[start] = 1;
    vector<int> stack;
    stack.push_back(start);
    int total = 0;
    while (!stack.empty()) {
      int now = stack.back();
      stack.pop_back();
      total++;
      for (int i = 0; i < graph[now].size(); i++)
        if (!vis[graph[now][i]]) {
          vis[graph[now][i]] = 1;
          stack.push_back(graph[now][i]);
        }
    }
    if (total != m * n) return 0 * printf("NO\n");
  }
  return 0 * printf("YES\n");
}
