#include <bits/stdc++.h>
using namespace std;
long long n, m;
char a[22], b[22];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (long long i = 1; i <= n; ++i) cin >> a[i];
  for (long long i = 1; i <= m; ++i) cin >> b[i];
  if ((a[1] == '>' && a[n] == '<' && b[1] == '^' && b[m] == 'v') ||
      (a[1] == '<' && a[n] == '>' && b[1] == 'v' && b[m] == '^'))
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
