#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
const int MAXN = 1e6 + 111;
char a[30], b[30];
int main() {
  int n, m;
  while (~scanf("%d%d", &n, &m)) {
    scanf("%s%s", a + 1, b + 1);
    if ((a[1] == '<' && b[1] == '^') || (a[1] == '>' && b[m] == '^') ||
        (a[n] == '<' && b[1] == 'v') || (a[n] == '>' && b[m] == 'v')) {
      printf("NO\n");
    } else
      printf("YES\n");
  }
  return 0;
}
