#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500 + 10;
const int MOD = 1e9 + 7;
int n, m;
vector<int> v[MAX_N];
bool mark[MAX_N];
void dfs(int u) {
  mark[u] = true;
  for (int i = 0; i < v[u].size(); i++) {
    if (!mark[v[u][i]]) dfs(v[u][i]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    int p = i + 1;
    if (s[i] == '>')
      for (int j = (p - 1) * m + 1; j < p * m; j++) v[j].push_back(j + 1);
    else
      for (int j = p * m; j > (p - 1) * m + 1; j--) v[j].push_back(j - 1);
  }
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    int p = i + 1;
    if (s[i] == 'v') {
      for (int j = 1; j < n; j++) {
        int r = p + ((j - 1) * m);
        int rr = p + (j * m);
        v[r].push_back(rr);
      }
    } else {
      for (int j = n; j > 1; j--) {
        int r = p + ((j - 1) * m);
        int rr = p + ((j - 2) * m);
        v[r].push_back(rr);
      }
    }
  }
  for (int i = 1; i <= m * n; i++) {
    memset(mark, false, sizeof mark);
    dfs(i);
    for (int i = 1; i <= m * n; i++) {
      if (!mark[i]) {
        cout << "NO";
        return 0;
      }
    }
  }
  cout << "YES";
}
