#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[3][22];
  int n, m, i, j;
  scanf("%d%d", &n, &m);
  getchar();
  for (i = 1; i <= 2; i++) scanf("%s", a[i]);
  j = 1;
  if (a[1][0] == '<' && a[2][0] == '^') j = 0;
  if (a[1][0] == '>' && a[2][m - 1] == '^') j = 0;
  if (a[1][n - 1] == '<' && a[2][0] == 'v') j = 0;
  if (a[1][n - 1] == '>' && a[2][m - 1] == 'v') j = 0;
  if (j)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
