#include <bits/stdc++.h>
using namespace std;
typedef struct type {
  int x, y;
} node;
node dir[20 + 5][20 + 5];
int visited[20 + 5][2 + 5];
int n, m;
bool valid(int sx, int sy) {
  if (sx < n && sx >= 0 && sy >= 0 && sy < m) return 1;
  return 0;
}
void dfs(int sx, int sy) {
  if (!valid(sx, sy) || visited[sx][sy] == 1)
    return;
  else {
    visited[sx][sy] = 1;
    dfs(sx + dir[sx][sy].x, sy);
    dfs(sx, dir[sx][sy].y + sy);
  }
}
int main() {
  cin >> n >> m;
  string s, s1;
  cin >> s;
  cin >> s1;
  if (s[0] == s[n - 1] || s1[0] == s1[m - 1] || (s[0] == '<' && s1[0] == '^') ||
      (s[0] == '>' && s1[0] == 'v'))
    cout << "NO";
  else
    cout << "YES";
  return 0;
}
