#include <bits/stdc++.h>
long long sod(long long x) {
  long long a = 0;
  while (x > 0) {
    a += (x % 10);
    x /= 10;
  }
  return a;
}
long long nod(long long x) {
  long long a = 0;
  while (x > 0) {
    a++;
    x /= 10;
  }
  return a;
}
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char a[n], b[m];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  if (a[0] != a[n - 1] && b[0] != b[m - 1] && a[0] == '<' && b[0] == 'v')
    cout << "YES";
  else if (a[0] != a[n - 1] && b[0] != b[m - 1] && a[0] == '>' && b[0] == '^')
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
