https://codeforces.com/contest/1131/problem/D

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=2000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k;
int ans,cnt,flag,temp;
int pre[N];
int ind[N];
int val[N];
char s[N][N];
vector<int> vc[N];
int Find(int x){
    if(x == pre[x]) return x;
    return pre[x] = Find(pre[x]);
}
queue<int> q;
void toposort(){
    for(int i = 1; i <= n+m; ++i){
//        cout << i << ' ' << ind[i] << endl;
        if(i == Find(i) && ind[i] == 0) {
            q.push(i), val[i] = 1;
//            cout  << i << endl;
        }
    }
    while(!q.empty()){
        int x = q.front();
        q.pop();
        for(int v : vc[x]){
            ind[v]--;
            if(ind[v] == 0){
                val[v] = val[x] + 1;
                q.push(v);

            }
        }
    }
}
int main()
{
#ifdef DEBUG
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#endif
    while(~scanf("%d%d", &n, &m)){
        for(int i = 1; i <= n + m; ++i) pre[i] = i, ind[i] = 0;
        for(int i = 1; i <= n; ++i){
            scanf("%s", s[i]+1);
            for(int j = 1; j <= m; ++j){
                if(s[i][j] == '='){
                    int u = Find(i), v = Find(n+j);
                    if(u == v) continue;
                    pre[u] = v;
                }
            }
        }
        for(int i = 1; i <= n; ++i){
            for(int j = 1; j <= m; ++j){
                if(s[i][j] == '=' ) continue;
                int u = Find(i), v = Find(n+j);
                if(s[i][j] == '<'){
                    vc[u].push_back(v);
                    ind[v]++;
                }
                else {
                    vc[v].push_back(u);
                    ind[u]++;
                }
            }
        }
        toposort();
        flag=1;
        for(int i = 1; i <= n+m; ++i){
            if(!val[Find(i)]){
                puts("No");
                flag=0;
                break;
            }
        }
        if(!flag)
            continue;
        puts("Yes");
        for(int i = 1; i <= n; ++i){
            printf("%d%c", val[Find(i)]," \n"[i==n]);
        }
        for(int i = 1; i <= m; ++i){
            printf("%d%c", val[Find(i+n)], " \n"[i==m]);
        }
    }
    //cout << "Hello world!" << endl;
    return 0;
}