#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
inline long long sbt(long long x) { return __builtin_popcountll(x); }
inline long long iceil(double a) { return (long long)(ceil(a)); }
inline long long mul(long long a, long long b,
                     long long m = (long long)(1e9 + 7)) {
  return ((a % m) * (b % m)) % m;
}
inline long long add(long long a, long long b,
                     long long m = (long long)(1e9 + 7)) {
  return (a + b) % m;
}
inline long long sub(long long a, long long b,
                     long long m = (long long)(1e9 + 7)) {
  return (a - b + m) % m;
}
long long fastpow(long long a, long long b,
                  long long m = (long long)(1e9 + 7)) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = mul(res, a, m);
    a = mul(a, a, m);
    b >>= 1;
  }
  return res;
}
long long modinv(long long a, long long m = (long long)(1e9 + 7)) {
  return fastpow(a, m - 2, m);
}
vector<pair<long long, long long> > adj[510][510];
long long n, m;
map<long long, long long> mp;
long long vis[510][510] = {0};
string a, b;
void dfs(long long i, long long j) {
  vis[i][j] = 1;
  for (auto k : adj[i][j]) {
    if (!vis[k.first][k.second]) {
      dfs(k.first, k.second);
    }
  }
}
void get_ac() {
  cin >> n >> m;
  cin >> a >> b;
  long long c = 1;
  for (auto i : a) {
    if (i == '<') {
      for (auto j = 2; j <= m; j++) {
        adj[c][j].push_back({c, j - 1});
      }
    } else {
      for (auto j = 1; j <= m - 1; j++) {
        adj[c][j].push_back({c, j + 1});
      }
    }
    c++;
  }
  c = 1;
  for (auto i : b) {
    if (i == 'v') {
      for (auto j = 1; j <= n - 1; j++) {
        adj[j][c].push_back({j + 1, c});
      }
    } else {
      for (auto j = 2; j <= n; j++) {
        adj[j][c].push_back({j - 1, c});
      }
    }
    c++;
  }
  for (auto i = 1; i <= n; i++) {
    for (auto j = 1; j <= m; j++) {
      for (auto y = 1; y <= n; y++) {
        for (auto z = 1; z <= m; z++) {
          vis[y][z] = 0;
        }
      }
      dfs(i, j);
      for (auto y = 1; y <= n; y++) {
        for (auto z = 1; z <= m; z++) {
          if (!vis[y][z]) {
            cout << "NO";
            return;
          }
        }
      }
    }
  }
  cout << "YES";
}
int main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  cin.tie(NULL);
  {
    get_ac();
    cout << "\n";
  }
  return 0;
}
