#include <bits/stdc++.h>
using namespace std;
int bigg = 100000000;
using namespace std;
int main() {
  int n, m, x, y;
  pair<int, int> one, two;
  pair<int, int> present;
  scanf("%d", &n);
  scanf("%d", &m);
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      v.push_back(make_pair(i, j));
    }
  }
  char rows[n];
  char columns[m];
  for (int i = 0; i < n; i++) {
    cin >> rows[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> columns[i];
  }
  int graph[n * m][n * m];
  for (int i = 0; i < n * m; i++) {
    for (int j = 0; j < n * m; j++) {
      if (i == j)
        graph[i][j] = 0;
      else
        graph[i][j] = bigg;
    }
  }
  for (int i = 0; i < n * m; i++) {
    x = v[i].first;
    y = v[i].second;
    one = make_pair(-1, -1);
    two = make_pair(-1, -1);
    if (rows[x] == '>') {
      if (y + 1 < m) {
        one = make_pair(x, y + 1);
      }
    } else {
      if (y - 1 >= 0) {
        one = make_pair(x, y - 1);
      }
    }
    if (columns[y] == '^') {
      if (x - 1 >= 0) {
        two = make_pair(x - 1, y);
      }
    } else {
      if (x + 1 < n) {
        two = make_pair(x + 1, y);
      }
    }
    for (int j = 0; j < n * m; j++) {
      present = v[j];
      if (present == one || present == two) {
        graph[i][j] = 1;
      }
    }
  }
  for (int k = 0; k < n * m; k++) {
    for (int i = 0; i < n * m; i++) {
      for (int j = 0; j < n * m; j++) {
        if (graph[i][k] != bigg && graph[k][j] != bigg &&
            graph[i][k] + graph[k][j] < graph[i][j]) {
          graph[i][j] = graph[i][k] + graph[k][j];
        }
      }
    }
  }
  int count = 0;
  for (int i = 0; i < n * m; i++) {
    for (int j = i + 1; j < n * m; j++) {
      if (graph[i][j] != bigg && graph[i][j] > 0) {
        count++;
      }
      if (graph[j][i] != bigg && graph[j][i] > 0) {
        count++;
      }
    }
  }
  if (count == n * m * (n * m - 1))
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
