#include <bits/stdc++.h>
using namespace std;
template <class T>
const T& max(const T& a, const T& b, const T& c) {
  return max(a, max(b, c));
}
template <class T>
const T& min(const T& a, const T& b, const T& c) {
  return min(a, min(b, c));
}
long long stoi(string& str) {
  istringstream second(str);
  long long i;
  second >> i;
  return i;
}
string itos(long long i) {
  stringstream second;
  second << i;
  return second.str();
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long poww(long long a, long long b) {
  long long res = 1;
  for (int i = 1; i <= b; i++) res *= a;
  return res;
}
long long sumOfDigs(string s) {
  long long sum = 0;
  for (int i = 0; i < s.length(); i++) sum += s[i] - '0';
  return sum;
}
long long mod = 1000000 + 3;
int program();
using namespace std;
pair<char, char> a[21][21];
bool vis[21][21];
int n, m;
bool dfs(int x1, int y1, int x2, int y2) {
  if (vis[x1][y1] || x1 > n || x1 < 1 || y1 > m || y1 < 1) return false;
  if (x1 == x2 && y1 == y2) {
    return true;
  }
  vis[x1][y1] = 1;
  bool b = 0;
  b |= (a[x1][y1].first == '>' ? dfs(x1, y1 + 1, x2, y2)
                               : dfs(x1, y1 - 1, x2, y2));
  b |= (a[x1][y1].second == '^' ? dfs(x1 - 1, y1, x2, y2)
                                : dfs(x1 + 1, y1, x2, y2));
  return b;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  string s, t;
  cin >> s >> t;
  for (int i = 0; i < s.length(); i++) {
    for (int j = 1; j <= m; j++) a[i + 1][j].first = s[i];
  }
  for (int i = 0; i < t.length(); i++) {
    for (int j = 1; j <= n; j++) a[j][i + 1].second = t[i];
  }
  vector<pair<int, int> > v;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) v.push_back(make_pair(i, j));
  for (int i = 0; i < v.size(); i++) {
    for (int j = i + 1; j < v.size(); j++) {
      if (!dfs(v[i].first, v[i].second, v[j].first, v[j].second)) {
        cout << "NO" << endl;
        return 0;
      }
      for (int i = 1; i <= 20; i++)
        for (int j = 1; j <= 20; j++) vis[i][j] = 0;
      if (!dfs(v[j].first, v[j].second, v[i].first, v[j].second)) {
        cout << "NO" << endl;
        return 0;
      }
      for (int i = 1; i <= 20; i++)
        for (int j = 1; j <= 20; j++) vis[i][j] = 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
