Mr. Apple, a gourmet, works as editor-in-chief of a gastronomic periodical. He travels around the world, tasting new delights of famous chefs from the most fashionable restaurants. Mr. Apple has his own signature method of review  — in each restaurant Mr. Apple orders two sets of dishes on two different days. All the dishes are different, because Mr. Apple doesn't like to eat the same food. For each pair of dishes from different days he remembers exactly which was better, or that they were of the same quality. After this the gourmet evaluates each dish with a positive integer.

Once, during a revision of a restaurant of Celtic medieval cuisine named «Poisson», that serves chestnut soup with fir, warm soda bread, spicy lemon pie and other folk food, Mr. Apple was very pleasantly surprised the gourmet with its variety of menu, and hence ordered too much. Now he's confused about evaluating dishes.

The gourmet tasted a set of $n$ dishes on the first day and a set of $m$ dishes on the second day. He made a table $a$ of size $n \times m$, in which he described his impressions. If, according to the expert, dish $i$ from the first set was better than dish $j$ from the second set, then $a_{ij}$ is equal to ">", in the opposite case $a_{ij}$ is equal to "<". Dishes also may be equally good, in this case $a_{ij}$ is "=".

Now Mr. Apple wants you to help him to evaluate every dish. Since Mr. Apple is very strict, he will evaluate the dishes so that the maximal number used is as small as possible. But Mr. Apple also is very fair, so he never evaluates the dishes so that it goes against his feelings. In other words, if $a_{ij}$ is "<", then the number assigned to dish $i$ from the first set should be less than the number of dish $j$ from the second set, if $a_{ij}$ is ">", then it should be greater, and finally if $a_{ij}$ is "=", then the numbers should be the same.

Help Mr. Apple to evaluate each dish from both sets so that it is consistent with his feelings, or determine that this is impossible.


-----Input-----

The first line contains integers $n$ and $m$ ($1 \leq n, m \leq 1000$) — the number of dishes in both days.

Each of the next $n$ lines contains a string of $m$ symbols. The $j$-th symbol on $i$-th line is $a_{ij}$. All strings consist only of "<", ">" and "=".


-----Output-----

The first line of output should contain "Yes", if it's possible to do a correct evaluation for all the dishes, or "No" otherwise.

If case an answer exist, on the second line print $n$ integers — evaluations of dishes from the first set, and on the third line print $m$ integers — evaluations of dishes from the second set.


-----Examples-----
Input
3 4
>>>>
>>>>
>>>>

Output
Yes
2 2 2 
1 1 1 1 

Input
3 3
>>>
<<<
>>>

Output
Yes
3 1 3 
2 2 2 

Input
3 2
==
=<
==

Output
No



-----Note-----

In the first sample, all dishes of the first day are better than dishes of the second day. So, the highest score will be $2$, for all dishes of the first day.

In the third sample, the table is contradictory — there is no possible evaluation of the dishes that satisfies it.

Difficulty: interview

Starter code:

Solutions:
'''input
3 3
>>>
<<<
>>>
'''
#print(input().split())
n, m = list(map(int, input().split()))
#return
g = []
for i in range(n):
	g += [input()]
# print(g)


memo = {}

def dfs(u):
	if u not in memo:
		memo[u] = res = 1
		if u < n:
			for v in range(m):
				if g[u][v] == '>':
					res = max(res, dfs(n + v) + 1)
			for v in range(m):
				if g[u][v] == '=':
					res = max(res, dfs(n + v))
			for v in range(m):
				if g[u][v] == '=':
					memo[n + v] = max(memo[n + v], res)
		else:
			for v in range(n):
				if g[v][u - n] == '<':
					res = max(res, dfs(v) + 1)
			for v in range(n):
				if g[v][u - n] == '=':
					res = max(res, dfs(v))
			for v in range(n):
				if g[v][u - n] == '=':
					memo[v] = max(memo[v], res)
		memo[u] = res
	return memo[u]
ans = [0] * (n + m)
for i in range(n + m):
	ans[i] = dfs(i)
for i in range(n):
	for j in range(m):
		if g[i][j] == '=' and ans[i] != ans[n + j]:
			print("No")
			return
		if g[i][j] == '<' and ans[i] >= ans[n + j]:
			print("No")
			return
		if g[i][j] == '>' and ans[i] <= ans[n + j]:
			print("No")
			return
print("Yes")
print(*ans[:n])
print(*ans[n:])


import sys
from collections import deque
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

N, M = map(int, readline().split())
L = [readline().strip() for i in range(N)]

def root(x):
    if x == p[x]:
        return x
    p[x] = y = root(p[x])
    return y
def unite(x, y):
    px = root(x); py = root(y)
    if px < py:
        p[py] = px
    else:
        p[px] = py

*p, = range(N+M)
for i in range(N):
    for j, c in enumerate(L[i]):
        if c == '=':
            unite(i, N+j)

G = [[] for i in range(N+M)]
RG = [[] for i in range(N+M)]
deg = [0]*(N+M)

for i in range(N):
    x = root(i)
    for j, c in enumerate(L[i]):
        y = root(N+j)
        if c == '<':
            G[x].append(y)
            RG[y].append(x)
            deg[y] += 1
        elif c == '>':
            G[y].append(x)
            RG[x].append(y)
            deg[x] += 1
A = [-1]*(N+M)

que = deque()
for i in range(N+M):
    if root(i) == i and deg[i] == 0:
        que.append(i)
while que:
    v = que.popleft()
    lb = 0
    for w in RG[v]:
        lb = max(lb, A[w])
    A[v] = lb+1
    for w in G[v]:
        deg[w] -= 1
        if deg[w] == 0:
            que.append(w)
if any(root(i) == i and A[i] == -1 for i in range(N+M)):
    print("No")
else:
    for i in range(N+M):
        A[i] = A[root(i)]
    print("Yes")
    print(*A[:N])
    print(*A[N:])

import sys

sys.setrecursionlimit(2000)


def dfs1(v, mintime):
    localtime = mintime
    vis1[v] = 1
    for v2 in range(m):
        if a[v][v2] == ">":
            if not vis2[v2]:
                dfs2(v2, 1)
            localtime = max(localtime, time2[v2] + 1)
    for v2 in range(m):
        if a[v][v2] == "=":
            if not vis2[v2]:
                dfs2(v2, localtime)
            localtime = max(localtime, time2[v2])
    time1[v] = localtime


def dfs2(v, mintime):
    localtime = mintime
    vis2[v] = 1
    for v2 in range(n):
        if a[v2][v] == "<":
            if not vis1[v2]:
                dfs1(v2, 1)
            localtime = max(localtime, time1[v2] + 1)
    for v2 in range(n):
        if a[v2][v] == "=":
            if not vis1[v2]:
                dfs1(v2, localtime)
            localtime = max(localtime, time1[v2])
    time2[v] = localtime


n, m = list(map(int, input().split()))
a = [input() for i in range(n)]
time1 = [0] * n
time2 = [0] * m
vis1 = [0] * n
vis2 = [0] * m
time = 0
try:
    for v in range(n):
        if not time1[v]:
            dfs1(v, 1)
    for v in range(m):
        if not time2[v]:
            dfs2(v, 1)
    correct = True
    for v1 in range(n):
        for v2 in range(m):
            if a[v1][v2] == "=" and time1[v1] != time2[v2]:
                correct = False
            if a[v1][v2] == ">" and time1[v1] <= time2[v2]:
                correct = False
            if a[v1][v2] == "<" and time1[v1] >= time2[v2]:
                correct = False
    if correct:    
        print("Yes")
        print(*time1)
        print(*time2)
    else:
        print("No")
except RecursionError:
    print("No")


def prov(mass, now):
    check = True
    for i in range(n):
        for k in range(m):
            if now[i][k] == '>' and mass[i] <= mass[n + k]:
                check = False
                break
            elif now[i][k] == '<' and mass[i] >= mass[n + k]:
                check = False
                break
            elif now[i][k] == '=' and mass[i] != mass[n + k]:
                check = False
                break
        if not check:
            break
    return check

def prog(mass, n, m):
    prov = True
    for i in range(1, m):
        for k in range(n):
            if mass[i][k] < mass[i - 1][k]:
                prov = False
                break
        if not prov:
            break
    if not prov:
        return False
    else:
        mass_new = []
        for i in range(1, m):
            mass_n = []
            for k in range(n):
                mass_n.append(mass[i][k] - mass[i - 1][k])
            mass_new.append(max(mass_n))
        arr = [1 for i in range(m)]
        now = 1
        if 1 in mass[0][:-1]:
            now += 1
            arr = [2 for i in range(m)]
        for i in range(1, m):
            now += mass_new[i - 1]
            arr[mass[i][-1]] = now
        return arr
    
n, m = map(int, input().split())
if n + m <= 6:
    now = []
    for i in range(n):
        now.append(input())
    ppp = True
    for i1 in range(n + m):
        for i2 in range(n + m):
            for i3 in range(n + m):
                for i4 in range(n + m):
                    for i5 in range(n + m):
                        for i6 in range(n + m):
                            mass = [i1 + 1, i2 + 1, i3 + 1, i4 + 1, i5 + 1, i6 + 1][:n + m]
                            if prov(mass, now) and ppp:
                                print('Yes')
                                print(*mass[:n])
                                print(*mass[n:])
                                ppp = False
    if ppp:
        print('No')
else:
    mass = [[] for i in range(m)]
    mass1 = [[] for i in range(n)]
    for i in range(n):
        now = input()
        for k in range(m):
            if now[k] == '<':
                mass[k].append(1)
                mass1[i].append(-1)
            elif now[k] == '=':
                mass[k].append(0)
                mass1[i].append(0)
            else:
                mass[k].append(-1)
                mass1[i].append(1)
    for i in range(m):
        mass[i].append(i)
    for i in range(n):
        mass1[i].append(i)
    mass.sort()
    mass1.sort()
    
    arr = prog(mass, n, m)
    arr1 = prog(mass1, m, n)
    if arr == False or arr1 == False:
        print('No')
    else:
        print('Yes')
        print(*arr1)
        print(*arr)    

n, m = (int(t) for t in input().split(' '))
def direction(c):
    if c == '=': return 0
    if c == '>': return 1
    return -1

mx = [[direction(c) for c in input()] for _ in range(n)]

index = 0
class DSet(object):
    def __init__(self, value):
        nonlocal index
        self.values = set([value])
        self.index = index
        index += 1
        self.edges_to = set()
        self.edges_from = set()

    def __len__(self):
        return len(self.values)
    def update(self, other_dset):
        self.values.update(other_dset.values)

    def add_edge_to(self, i):
        self.edges_to.add(i)

    def add_edge_from(self, i):
        self.edges_from.add(i)

    def remove_edge_from(self, i):
        self.edges_from.remove(i)

dsu = [DSet(i) for i in range(n+m)]

def union(v1, v2):
    if len(dsu[v1]) > len(dsu[v2]):
        d = dsu[v1]
        d.update(dsu[v2])
    else:
        d = dsu[v2]
        d.update(dsu[v1])

    dsu[v1] = dsu[v2] = d

for i in range(n):
    for j in range(m):
        if not mx[i][j]:
            union(i, n + j)

for i in range(n):
    for j in range(m):
        if mx[i][j] > 0:
            dsu[i].add_edge_from(dsu[n + j].index)
            dsu[n+j].add_edge_to(dsu[i].index)
        elif mx[i][j] < 0:
            dsu[n + j].add_edge_from(dsu[i].index)
            dsu[i].add_edge_to(dsu[n+j].index)

weights = [1] * (n+m)
dsu_by_index = { d.index: d for d in dsu }

while True:
    try:
        v = next(d for d in range(n+m) if not len(dsu[d].edges_from) and len(dsu[d].edges_to))
    except:
        break

    dsuv = dsu[v]
    for edge in dsu[v].edges_to:
        dsue = dsu_by_index[edge]
        dsue.remove_edge_from(dsuv.index)
        for value in dsue.values:
            weights[value] = weights[v] + 1

    dsu[v].edges_to.clear()

ok = all(not len(d.edges_from) and not len(d.edges_to) for d in dsu)
if ok:
    print('Yes')
    print(*weights[0:n])
    print(*weights[n:])
else:
    print('No')


r,c = map(int, input().split())

m = []

p = [i for i in range(0,r+c)]
tree = [[] for i in range(0, r+c)]

for i in range(0,r):
    s = input().split('\n')[0]
    m.append(list(s))

def find(i):
    if p[i] ==i:
        return i
    par =  find(p[i])
    p[i] = par
    return p[i]

def join(i,j):
    p[find(i)] = find(j)

for i in range(0,r):
    for j in range(0,c):
        if m[i][j] == '=':
            join(i,r+j)
        elif m[i][j] == '>':
            tree[i].append(r+j)
        elif m[i][j] == '<':
            tree[r+j].append(i)

v = [False for i in range(0, r+c)]
v2 = [False for i in range(0, r+c)]

a = [1 for i in range(0,r+c)]
l = [[] for i in range(0,r+c)]

for i in range(0,r+c):
    l[find(i)].append(i)

import sys

def dfs(i):
    i = find(i)
    if v[i]:
        return sys.maxsize
    elif v2[i]:
        return a[i]
    v[i] = True
    for k in l[i]:
        for j in tree[k]:
            a[i] = max(dfs(j)+1, a[i])
    v[i] = False
    v2[i] = True
    return a[i]


A = []

ans = True
for i in range(0,r+c):
    A.append(dfs(i))
    if A[i] > r+c:
        ans = False


m = {}
index = 0
pre = -1
for i in sorted(A):
    if pre == i:
        m[i] = index
    else:
        pre = i
        index+=1
        m[i] = index


for i in range(0,r+c):
    A[i] = m[A[i]]
if ans:
    print("Yes")
    print(str(A[:r]).replace(',','').replace('[','').replace(']',''))
    print(str(A[r:]).replace(',','').replace('[','').replace(']',''))
else:
    print("No")

class UnionFind:
 
    def __init__(self, n):
        self.follow = [-1]*(n+1)
        self.num_follower = [1]*(n+1)
 
    def root_index_of(self, a):
        r = a
        while self.follow[r] > -1:
                 r = self.follow[r]
        return r
 
    def connected(self, a, b):
        return self.root_index_of(a) == self.root_index_of(b)
 
    def connect(self, a, b):
        ra = self.root_index_of(a)
        rb = self.root_index_of(b)
 
        if ra == rb:
            return
 
        if self.num_follower[ra] < self.num_follower[rb]:
            self.follow[ra] = rb
            self.follow[a] = rb
            self.num_follower[rb] += self.num_follower[ra]
        else:
            self.follow[rb] = ra
            self.follow[b] = ra
            self.num_follower[ra] += self.num_follower[rb]

import sys
from collections import deque
input = sys.stdin.readline
n, m = map(int, input().split())
s = [input() for _ in range(n)]

uf = UnionFind(n+m)
v = [[] for _ in range(n+m)]
c = [0]*(n+m)
for i in range(n):
    for j in range(m):
        if s[i][j] == "=":
            uf.connect(i, j+n)

for i in range(n):
    for j in range(m):
        if s[i][j] == "<":
            v[uf.root_index_of(i)].append(uf.root_index_of(n+j))
            c[uf.root_index_of(n+j)] += 1
        elif s[i][j] == ">":
            v[uf.root_index_of(n+j)].append(uf.root_index_of(i))
            c[uf.root_index_of(i)] += 1


ans = [0]*(n+m)
used = [0]*(n+m)
que = deque([])
for i in range(n+m):
    if c[i] == 0:
        ans[i] = 1
        used[i] = 1
        que.append(i)


while que:
    x = que.popleft()
    for i in v[x]:
        if used[i]:
            continue
        ans[i] = max(ans[x]+1, ans[i])
        c[i] -= 1
        if c[i] == 0:
            used[i] = 1
            que.append(i)

for i in range(n+m):
    if used[i] == 0:
        print("No")
        return

for i in range(n):
    for j in range(m):
        if s[i][j] == "=":
            if ans[uf.root_index_of(i)] != ans[uf.root_index_of(n+j)]:
                print("No")
                return

for i in range(n):
    for j in range(m):
        if s[i][j] == "<":
            if ans[uf.root_index_of(i)] >= ans[uf.root_index_of(n+j)]:
                print("No")
                return

for i in range(n):
    for j in range(m):
        if s[i][j] == ">":
            if ans[uf.root_index_of(i)] <= ans[uf.root_index_of(n+j)]:
                print("No")
                return

print("Yes")
for i in range(n):
    print(ans[uf.root_index_of(i)], end=" ")
print()
for j in range(m):
    print(ans[uf.root_index_of(j+n)], end=" ")
print()



import os
from io import BytesIO
#input = BytesIO(os.read(0, os.fstat(0).st_size)).readline

from itertools import product

class CYCLE(Exception):
    ...

debug_print = lambda *args: None

def solve(n, m, gs):
    def union(u, v):
        p, q = find(u), find(v)
        if p == q: return
        if rank[p] < rank[q]: p, q = q, p
        if rank[p] == rank[q]: rank[p] += 1
        parent[q] = p

    def find(u):
        if parent[u] == u: return u
        else:
            p = find(parent[u])
            parent[u] = p
            return p

    rank = [0] * (n + m)
    parent = list(range(n + m))

    for i, j in product(range(n), range(m)):
        if gs[i][j] == "=":
            union(i, n + j)

    vertices = set(parent)
    v_sz = len(vertices)
    g = [set() for _ in range(n + m)]

    for i, j in product(range(n), range(m)):
        c = gs[i][j]
        i, j = parent[i], parent[n + j]

        if c == "<":
            g[i].add(j)
        elif c == ">":
            g[j].add(i)

    debug_print(vertices, g)

    NIL, VISITED, FINAL = 0, 1, 2
    state = [NIL] * (n + m)
    toposort_stack = []

    def visit(v):
        debug_print(v)
        if state[v] == VISITED:
            raise CYCLE

        state[v] = VISITED
        for u in g[v]:
            if state[u] != FINAL:
                visit(u)
        state[v] = FINAL
        toposort_stack.append(v)

    try:
        for v in vertices:
            if state[v] == FINAL:
                continue
            visit(v)
    except CYCLE:
        print('No')
        return

    debug_print(toposort_stack)

    layer = [1] * (n + m)

    while toposort_stack:
        v = toposort_stack.pop()
        for u in g[v]:
            layer[u] = max(layer[u], layer[v]+1)

    print('Yes')

    out = []
    for i in range(n):
        out.append(str(layer[parent[i]]))
    print(' '.join(out))

    out = []
    for j in range(m):
        out.append(str(layer[parent[n + j]]))
    print(' '.join(out))


def solve_from_stdin():
    n, m = map(int, input().split())
    gs = []
    for _ in range(n):
        gs.append(input())
    solve(n, m, gs)

solve_from_stdin()

class mergefind:
    def __init__(self,n):
        self.parent = list(range(n))
        self.size = [1]*n
        self.num_sets = n

    def find(self,a):
        to_update = []
       
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
       
        for b in to_update:
            self.parent[b] = a

        return self.parent[a]

    def merge(self,a,b):
        a = self.find(a)
        b = self.find(b)

        if a==b:
            return

        if self.size[a]<self.size[b]:
            a,b = b,a

        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets

def toposort(C, n):
    indeg = [0]*n
    for i,neighs in enumerate(C):
        for neigh in neighs:
            indeg[neigh] += 1

    S = [i for i in range(n) if indeg[i] == 0]
    nparent = indeg[:]
    topo = []
    while S:
        cur = S.pop()
        topo.append(cur)
        for neigh in C[cur]:
            nparent[neigh] -= 1
            if nparent[neigh] == 0:
                S.append(neigh)
        nparent[cur] = -1
    return topo


n,m = list(map(int,input().split()))
A = [input() for _ in range(n)]

mf = mergefind(n+m)

# merge equal elements
for i in range(n):
    for j in range(m):
        if A[i][j] == '=':
            mf.merge(i,n+j)

# Connections: smaller -> larger
C = [set() for _ in range(n+m)]
for i in range(n):
    for j in range(m):
        if A[i][j] == '<':
            C[mf.find(i)].add(mf.find(n+j))
        elif A[i][j] == '>':
            C[mf.find(n+j)].add(mf.find(i))

# Walk through graph in toposort order
# What I'm pointing to must be at least
# my value + 1
D = [1]*(n+m)
for cur in toposort(C, n+m):
    for neigh in C[cur]:
        D[neigh] = max(D[neigh], D[cur]+1)

# Propagate values within equal clusters
D = [D[mf.find(i)] for i in range(n+m)]

# Validate answer
ok = True
for i in range(n):
    for j in range(m):
        if A[i][j] == '<':
            if D[i] >= D[n+j]:
                ok = False
        elif A[i][j] == '>':
            if D[i] <= D[n+j]:
                ok = False
        else:
            if D[i] != D[n+j]:
                ok = False

if ok:
    print('Yes')
    print(*D[:n])
    print(*D[n:])
else:
    print('No')



class mergefind:
    def __init__(self,n):
        self.parent = list(range(n))
        self.size = [1]*n
        self.num_sets = n

    def find(self,a):
        to_update = []
       
        while a != self.parent[a]:
            to_update.append(a)
            a = self.parent[a]
       
        for b in to_update:
            self.parent[b] = a

        return self.parent[a]

    def merge(self,a,b):
        a = self.find(a)
        b = self.find(b)

        if a==b:
            return

        if self.size[a]<self.size[b]:
            a,b = b,a

        self.num_sets -= 1
        self.parent[b] = a
        self.size[a] += self.size[b]

    def set_size(self, a):
        return self.size[self.find(a)]

    def __len__(self):
        return self.num_sets

def toposort(C, n):
    indeg = [0]*n
    for i,neighs in enumerate(C):
        for neigh in neighs:
            indeg[neigh] += 1

    S = [i for i in range(n) if indeg[i] == 0]
    nparent = indeg[:]
    topo = []
    while S:
        cur = S.pop()
        topo.append(cur)
        for neigh in C[cur]:
            nparent[neigh] -= 1
            if nparent[neigh] == 0:
                S.append(neigh)
#         nparent[cur] = -1
    return topo


n,m = map(int,input().split())
A = [input() for _ in range(n)]

mf = mergefind(n+m)

# merge equal elements
for i in range(n):
    for j in range(m):
        if A[i][j] == '=':
            mf.merge(i,n+j)

# Connections: smaller -> larger
C = [set() for _ in range(n+m)]
for i in range(n):
    for j in range(m):
        if A[i][j] == '<':
            C[mf.find(i)].add(mf.find(n+j))
        elif A[i][j] == '>':
            C[mf.find(n+j)].add(mf.find(i))

# Walk through graph in toposort order
# What I'm pointing to must be at least
# my value + 1
D = [1]*(n+m)
for cur in toposort(C, n+m):
    for neigh in C[cur]:
        D[neigh] = max(D[neigh], D[cur]+1)

# Propagate values within equal clusters
D = [D[mf.find(i)] for i in range(n+m)]

# Validate answer
ok = True
for i in range(n):
    for j in range(m):
        if A[i][j] == '<':
            if D[i] >= D[n+j]:
                ok = False
        elif A[i][j] == '>':
            if D[i] <= D[n+j]:
                ok = False
        else:
            if D[i] != D[n+j]:
                ok = False

if ok:
    print('Yes')
    print(*D[:n])
    print(*D[n:])
else:
    print('No')

#!/usr/bin/env pypy
import collections
#import random
import heapq
import bisect
import math
import time


class Solution2:
    def solve(self, A1, A2):
        pass


def gcd(a, b):
    if not b: return a
    return gcd(b, a%b)
def lcm(a, b):
    return b*a//gcd(b,a)


class Solution:

    def solve(self, grid):
        def union(i,j):
            leader_i, leader_j = find(i), find(j)
            sets[leader_j] = sets[i] = sets[j] = leader_i
        def find(i):
            while i != sets[i]:
                i = sets[i]
            return i
        N = len(grid) + len(grid[0])
        sets = list(range(N))
        for i in range(len(grid)):
            for j in range(len(grid[0])):
                if grid[i][j] == '=': union(i,j+len(grid))

        graph = collections.defaultdict(set)
        inc = collections.defaultdict(set)
        for i in range(len(grid)):
            for j in range(len(grid[0])):
                leader_i, leader_j = find(i), find(j+len(grid))
                if grid[i][j] == '>':
                    if leader_i == leader_j: 
                        print("No")
                        return
                    graph[leader_j].add(leader_i)
                    inc[leader_i].add(leader_j)
                elif grid[i][j] == '<':
                    if leader_i == leader_j: 
                        print("No")
                        return
                    graph[leader_i].add(leader_j)
                    inc[leader_j].add(leader_i)

        self.levels = [0]*N
        def dfs(node, level):
            self.levels[node] = max(self.levels[node],level)
            if not inc[node]:
                seen.add(node)
                for next_node in graph[node]:
                    inc[next_node].discard(node)
                    dfs(next_node,self.levels[node]+1)

        seen = set()
        for i in range(N):
            l = find(i)
            if not inc[l] and l not in seen:
                seen.add(l)
                dfs(l, 1)

        if any(inc[find(node)] for node in range(N)):
            print("No")
            return

        for i in range(N):
            l = find(i)
            if l != i:
                self.levels[i] = self.levels[l]

        print("Yes")
        print(' '.join(str(o) for o in self.levels[:len(grid)]))
        print(' '.join(str(o) for o in self.levels[len(grid):]))


sol = Solution()
sol2 = Solution2()

#TT = int(input())
for test_case in range(1):
    N, M = input().split()
    a = []
    for _ in range(int(N)):
        a.append(input())
    #b = [int(c) for c in input().split()]

    out = sol.solve(a)
    #print(' '.join([str(o) for o in out]))
    #print(str(out))

    # out2 = sol2.solve(s)


# for _ in range(100000):
#     rand = [random.randrange(60) for _ in range(10)]
#     out1 = sol.solve(rand)
#     out2 = sol2.solve(rand)
#     if out1 != out2: 
#         print(rand, out1, out2)
#         break


import time

debug = False

n1, m2 = list(map(int, input().split()))

tests = []
for i in range(n1):
	tests.append(list(input()))

if debug:
	print (tests)

begin = time.time()

if debug:
	print("---")

marks1 = []
result1 = []
for i in range(n1):
	marks1.append([i,0.0])
	result1.append(0)

marks2 = []
result2 = []
for j in range(m2):
	marks2.append([j,0.0])
	result2.append(0)

for i in range(n1):
	for j in range(m2):
		test = tests[i][j]
		if test == ">":
			marks1[i][1] += 1.0
		elif test == "<":
			marks2[j][1] += 1.0
		else:
			marks1[i][1] += 0.0001
			marks2[j][1] += 0.0001

marks1.sort(key=lambda val: val[1])
marks2.sort(key=lambda val: val[1])

if debug:
	print(marks1)
	print(marks2)

i = 0
j = 0
value = 0
lastmark = -1
lastItem = [0,0]

while i < n1 or j < m2:
	LetAdd = 0
	if i < n1 and j < m2:
		test = tests[marks1[i][0]][marks2[j][0]]
		if test == ">":
			LetAdd = 2
		else:
			LetAdd = 1
	elif i < n1:
		LetAdd = 1
	else:
		LetAdd = 2

	if LetAdd == 1:
		if marks1[i][1] != lastmark and lastItem[0] != 2 or lastItem[0] == 2 and tests[marks1[i][0]][lastItem[1]] != '=':
			if debug:
				if lastItem[0] == 2:
					print(1, lastmark, lastItem, marks1[i][0], tests[marks1[i][0]][lastItem[1]])
				else:
					print(1, lastmark, lastItem, marks1[i][0])
			value += 1
		lastmark = marks1[i][1]
		result1[marks1[i][0]] = value
		lastItem = [1,marks1[i][0]]
		i += 1
	else:
		if marks2[j][1] != lastmark and lastItem[0] != 1 or lastItem[0] == 1 and tests[lastItem[1]][marks2[j][0]] != '=':
			if debug:
				if lastItem[0] == 1:
					print(2, lastmark, lastItem, marks2[j][0], tests[lastItem[1]][marks2[j][0]])
				else:
					print(2, lastmark, lastItem, marks2[j][0])
			value += 1
		lastmark = marks2[j][1]
		result2[marks2[j][0]] = value
		lastItem = [2,marks2[j][0]]
		j += 1
	if debug:
		print("Set ", lastItem, " to ", value)

CheckCorrect = True
for i in range(n1):
	for j in range(m2):
		test = tests[i][j]
		if test == ">":
			if result1[i] <= result2[j]:
				CheckCorrect = False
		elif test == "<":
			if result1[i] >= result2[j]:
				CheckCorrect = False
		else:
			if result1[i] != result2[j]:
				CheckCorrect = False
if debug:
	print("---")

if debug:
	print("Time: ", time.time() - begin)

if CheckCorrect:
	print ("Yes")
else:
	print ("No")

if CheckCorrect or debug:
	print(*result1)
	print(*result2)