Farmer John's $N$ cows ($1 \le N \le 10000$), numbered $1$ through $N$, are standing in a line. Every cow has a positive integer height, most of which are secret. You are told only the height $H$ ($1 \le H \le 1000000$) of the tallest cow and its index $I$.
You are also given $R$ pieces of information ($0 \le R \le 10000$) of the form "cow $a$ sees cow $b$". This means cow $b$ is at least as tall as cow $a$, and every cow strictly between $a$ and $b$ is strictly shorter than cow $a$.
For each cow from $1$ to $N$, determine its maximum possible height so that all of the given information still holds. It is guaranteed that all constraints can be satisfied simultaneously.