#include <bits/stdc++.h>
char a[30], b[30];
int main() {
  int n, m, i, ans = 1;
  scanf("%d %d\n", &n, &m);
  for (i = 1; i <= n; i++) scanf("%c\n", &a[i]);
  for (i = 1; i <= m; i++) scanf("%c\n", &b[i]);
  if ((a[1] == '>' && b[1] == 'v') || (a[1] == '<' && b[1] == '^'))
    ans = 0;
  else if ((a[n] == '>' && b[1] == '^') || (a[n] == '<' && b[1] == 'v'))
    ans = 0;
  else if ((a[1] == '>' && b[m] == '^') || (a[1] == '<' && b[m] == 'v'))
    ans = 0;
  else if ((a[n] == '>' && b[m] == 'v') || (a[n] == '<' && b[m] == '^'))
    ans = 0;
  else
    ;
  if (ans)
    printf("YES");
  else
    printf("NO");
  return 0;
}
