class unif: def __init__(self,n): self.pare=[-1]*n self.size=[1]*n self.count=[0]*n for i in range(n): if i%2==0: self.count[i]=1 def root(self,x): while self.pare[x]!=-1: x=self.pare[x] return x def unite(self,u,v): rootu=self.root(u) rootv=self.root(v) if rootu!=rootv: if self.size[rootu]>=self.size[rootv]: self.pare[rootv]=rootu self.size[rootu]+=self.size[rootv] self.count[rootu]+=self.count[rootv] else: self.pare[rootu]=rootv self.size[rootv]+=self.size[rootu] self.count[rootv]+=self.count[rootu] def same(self,s,t): return self.root(s)==self.root(t) N,M=map(int,input().split()) Z=unif(2*N) for i in range(M): a,s,b=input().split() a=int(a) b=int(b) a-=1 b-=1 if s=='<==>': if Z.same(2*a,2*b+1)==True: print('No') exit() Z.unite(2*a,2*b) Z.unite(2*a+1,2*b+1) else: if Z.same(2*a,2*b)==True: print('No') exit() Z.unite(2*a,2*b+1) Z.unite(2*b,2*a+1) A=set() print('Yes') result=[] NG=set() for i in range(N): if Z.count[Z.root(2*i)]>=(Z.size[Z.root(2*i)]+1)//2: if Z.root(2*i) in NG: continue result.append(i+1) NG.add(Z.root(2*i+1)) print(len(result)) print(*result)