#include <bits/stdc++.h>
using namespace std;
int n, m;
string we, ns, sol = "";
void fast() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  cin >> n >> m;
  cin >> we;
  cin >> ns;
  sol += we[0];
  sol += we.back();
  sol += ns[0];
  sol += ns.back();
  if (sol == "<>v^" || sol == "><^v") {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
