#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
inline long long getint() {
  int c;
  while (c = getchar(), (c < '0' || c > '9') && (c != '-') && (c != EOF))
    ;
  if (c == EOF) return -1;
  bool flag = (c == '-');
  if (flag) c = getchar();
  long long x = 0;
  while (c >= '0' && c <= '9') {
    x = (x << 3) + x + x + c - '0';
    c = getchar();
  }
  return flag ? -x : x;
}
inline void writeln(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int len = 0, buf[20];
  while (x) {
    buf[len++] = x % 10;
    x /= 10;
  }
  if (!len) buf[len++] = 0;
  while (len--) putchar(buf[len] + '0');
  putchar('\n');
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int len = 0, buf[20];
  while (x) {
    buf[len++] = x % 10;
    x /= 10;
  }
  if (!len) buf[len++] = 0;
  while (len--) putchar(buf[len] + '0');
}
const int N = 20 + 10;
bool vis[N][N];
int n, m;
char row[N];
char col[N];
int cnt;
void dfs(int x, int y) {
  vis[x][y] = 1;
  ++cnt;
  int nx, ny;
  if (row[x] == '>') {
    nx = x;
    ny = y + 1;
  } else {
    nx = x;
    ny = y - 1;
  }
  if (nx >= 0 && nx < n && ny >= 0 && ny < m && !vis[nx][ny]) {
    dfs(nx, ny);
  }
  if (col[y] == 'v') {
    nx = x + 1;
    ny = y;
  } else {
    nx = x - 1;
    ny = y;
  }
  if (nx >= 0 && nx < n && ny >= 0 && ny < m && !vis[nx][ny]) {
    dfs(nx, ny);
  }
}
bool solve() {
  for (int i = (0); i < (n); ++i) {
    for (int j = (0); j < (m); ++j) {
      memset(vis, 0, sizeof(vis));
      ;
      cnt = 0;
      dfs(i, j);
      if (cnt != n * m) {
        return 0;
      }
    }
  }
  return 1;
}
int main() {
  n = getint();
  m = getint();
  gets(row);
  gets(col);
  if (solve()) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
}
