#include <bits/stdc++.h>
using namespace std;
bool Check(int N, int pos) { return (bool)(N & (1 << pos)); }
int Set(int N, int pos) { return (N | (1 << pos)); }
int fx[] = {-1, 0, 1, 0};
int fy[] = {0, 1, 0, -1};
inline long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
int row[25], col[25];
bool vis[25][25];
int n, m;
int counter;
void dfs(int x, int y) {
  if (x < 0 or y < 0 or x >= n or y >= m) return;
  if (vis[x][y]) return;
  vis[x][y] = 1;
  counter++;
  if (row[x] == 1)
    dfs(x, y + 1);
  else
    dfs(x, y - 1);
  if (col[y] == 1)
    dfs(x + 1, y);
  else
    dfs(x - 1, y);
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    char ch;
    cin >> ch;
    if (ch == '>') row[i] = 1;
  }
  for (int i = 0; i < m; i++) {
    char ch;
    cin >> ch;
    if (ch == 'v') col[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      memset(vis, 0, sizeof(vis));
      counter = 0;
      dfs(i, j);
      if (counter != n * m) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
}
