#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string a, b;
  cin >> a >> b;
  cout << ((a[0] == '<' && a[n - 1] == '>' && b[0] == 'v' && b[m - 1] == '^' ||
            a[0] == '>' && a[n - 1] == '<' && b[0] == '^' && b[m - 1] == 'v')
               ? "YES"
               : "NO")
       << endl;
  return 0;
}
