#include <bits/stdc++.h>
using namespace std;
map<int, vector<int>> m;
map<int, vector<int>> mm;
vector<bool> c;
stack<int> st;
vector<int> v;
vector<vector<int>> vec;
void fin(int i) {
  if (c[i - 1]) return;
  int j;
  c[i - 1] = true;
  for (j = 0; j < mm[i].size(); j++) {
    if (!c[mm[i][j] - 1]) fin(mm[i][j]);
  }
  v.push_back(i);
}
void find(int i) {
  if (c[i - 1]) return;
  c[i - 1] = true;
  int j;
  for (j = 0; j < m[i].size(); j++) {
    if (!c[m[i][j] - 1]) find(m[i][j]);
  }
  st.push(i);
}
int main() {
  int n, k;
  cin >> n >> k;
  int i, j;
  string s, ss;
  cin >> s >> ss;
  for (i = 0; i < n; i++) {
    for (j = 0; j < k; j++) {
      if (s[i] == '>' && j != k - 1) {
        m[i * k + j + 1].push_back(i * k + j + 2);
      } else if (s[i] == '<' && j != 0) {
        m[i * k + j + 1].push_back(i * k + j);
      }
      if (ss[j] == '^' && i != 0) {
        m[i * k + j + 1].push_back((i - 1) * k + j + 1);
      } else if (ss[j] != '^' && i != n - 1) {
        m[i * k + j + 1].push_back((i + 1) * k + j + 1);
      }
      if (s[i] == '>' && j != 0) {
        mm[i * k + j + 1].push_back(i * k + j);
      } else if (s[i] == '<' && j != k - 1) {
        mm[i * k + j + 1].push_back(i * k + j + 2);
      }
      if (ss[j] == '^' && i != n - 1) {
        mm[i * k + j + 1].push_back((i + 1) * k + j + 1);
      } else if (ss[j] != '^' && i != 0) {
        mm[i * k + j + 1].push_back((i - 1) * k + j + 1);
      }
    }
  }
  for (i = 0; i <= n * k; i++) c.push_back(false);
  for (i = 1; i <= n * k; i++) {
    if (!c[i - 1]) find(i);
  }
  c.clear();
  for (i = 0; i <= n * k; i++) c.push_back(false);
  while (!st.empty()) {
    v.clear();
    if (!c[st.top() - 1]) fin(st.top());
    st.pop();
    if (v.size() > 0) vec.push_back(v);
    v.clear();
    if (vec.size() > 1) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
