We consider a set GGG consisting of nnn entities and the relations on GGG. For simplicity, these nnn entities are labeled from 111 to nnn.
The ranking RRR on GGG is defined as an nnn-order permutation R=r1,r2,…rnR = r_1,r_2,\dots r_nR=r1,r2,…rn (1≤ri≤n1\leq r_i\leq n1≤ri≤n).
The winning relation on GGG is defined as an ordered pair ⟨u,v⟩\langle u, v\rangle⟨u,v⟩ (1≤u,v≤n1\leq u,v\leq n1≤u,v≤n, u≠vu\neq vu=v), representing that the entity uuu wins in the competition with the entity vvv.
We say that the ranking RRR satisfies the winning relation ⟨u,v⟩\langle u, v\rangle⟨u,v⟩ if and only if there exist 1≤i<j≤n1\leq i<j\leq n1≤i<j≤n such that ri=ur_i=uri=u and rj=vr_j=vrj=v.
Given the number of entities nnn, and mmm winning relations, you are required to construct the minimal number of rankings such that each winning relation is satisfied by at least one ranking in the constructed rankings.