#include <bits/stdc++.h>
int main() {
  char a, b, c, d;
  int n, m;
  scanf("%d %d", &n, &m);
  getchar();
  a = getchar();
  for (int i = 2; i < n; i++) getchar();
  b = getchar();
  getchar();
  c = getchar();
  for (int i = 2; i < m; i++) getchar();
  d = getchar();
  printf("%s\n", (((a != b) && (c != d)) &&
                  (((a == '>') && (c == '^')) || ((a == '<') && (c == 'v'))))
                     ? "YES"
                     : "NO");
  return 0;
}
