#include <bits/stdc++.h>
using namespace std;
const int maxn = 105;
char cc1[maxn], cc2[maxn];
int n, m, cnt1, cnt2;
void solve() {
  if (n == 1 && m == 1) {
    printf("YES\n");
    return;
  }
  for (int i = 0; i < n - 1; i++) {
    if (cc1[i] != cc1[i + 1]) cnt1++;
  }
  for (int i = 0; i < m - 1; i++) {
    if (cc2[i] != cc2[i + 1]) cnt2++;
  }
  cnt1++;
  cnt2++;
  if (cnt1 % 2 == 0 && cnt2 % 2 == 0) {
    if (cc1[0] == '<' && cc2[0] == '^')
      printf("NO\n");
    else if (cc1[n - 1] == '<' && cc2[0] == 'v')
      printf("NO\n");
    else
      printf("YES\n");
  } else {
    printf("NO\n");
  }
}
int main() {
  cnt1 = cnt2 = 0;
  scanf("%d%d", &n, &m);
  scanf("%s", cc1);
  scanf("%s", cc2);
  solve();
}
