#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
const int MOD_ONE = 1e9 + 7;
const int INF = 2e5 + 5;
using ll = long long;
using db = double;
int dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
int n, m;
string s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> n >> m >> s1 >> s2;
  string ans = "";
  ans += s1[0];
  ans += s1[n - 1];
  ans += s2[0];
  ans += s2[m - 1];
  if (ans == "<>v^" || ans == "><^v") {
    cout << "YES"
         << "\n";
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}
