#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
bool vis[100005] = {0};
bool dfs(long long int s, long long int dest) {
  vis[s] = true;
  if (s == dest) return true;
  for (int i = 0; i < v[s].size(); i++) {
    if (vis[v[s][i]] == false) {
      vis[v[s][i]] = 1;
      if (dfs(v[s][i], dest)) return true;
    }
  }
  return false;
}
int main() {
  long long int n, m;
  cin >> n >> m;
  string s1, s2;
  cin >> s1 >> s2;
  long long int a = 1;
  int A[n + 5][m + 5];
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (m); ++j) {
      A[i][j] = a++;
    }
  }
  for (int j = 0; j < s1.size(); j++) {
    for (int i = 0; i < m - 1; i++) {
      if (s1[j] == '>')
        v[A[j][i]].push_back(A[j][i + 1]);
      else
        v[A[j][i + 1]].push_back(A[j][i]);
    }
  }
  for (int j = 0; j < s2.size(); j++) {
    for (int i = 0; i < n - 1; i++) {
      if (s2[j] == 'v')
        v[A[i][j]].push_back(A[i + 1][j]);
      else
        v[A[i + 1][j]].push_back(A[i][j]);
    }
  }
  for (int i = (1); i < (n * m); ++i) {
    for (int j = (1); j < (n * m); ++j) {
      if (!dfs(i, j)) {
        cout << "NO\n";
        return 0;
      }
      memset((vis), 0, sizeof(vis));
    }
  }
  cout << "YES\n";
}
