Output #1
6
2
6
Initially, Infant $1, 4$ belongs to Kindergarten $1$, Infant $2, 5$ belongs to Kindergarten $2$, and Infant $3, 6$ belongs to Kindergarten $3$.
After the $1$\-st transfer that makes Infant $4$ belong to Kindergarten $3$, Infant $1$ belongs to Kindergarten $1$, Infant $2, 5$ belong to Kindergarten $2$, and Infant $3, 4, 6$ belong to Kindergarten $3$. The highest ratings of an infant in Kindergarten $1, 2, 3$ are $8, 6, 9$, respectively. The lowest among them is $6$, so the $1$\-st line in the output should contain $6$.
After the $2$\-nd transfer that makes Infant $2$ belong to Kindergarten $1$, Infant $1, 2$ belong to Kindergarten $1$, Infant $5$ belongs to Kindergarten $2$, and Infant $3, 4, 6$ belong to Kindergarten $3$. The highest ratings of an infant in Kindergarten $1, 2, 3$ are $8, 2, 9$, respectively. The lowest among them is $2$, so the $2$\-nd line in the output should contain $2$.
After the $3$\-rd transfer that makes Infant $1$ belong to Kindergarten $2$, Infant $2$ belongs to Kindergarten $1$, Infant $1, 5$ belong to Kindergarten $2$, and Infant $3, 4, 6$ belong to Kindergarten $3$. The highest ratings of an infant in Kindergarten $1, 2, 3$ are $6, 8, 9$, respectively. The lowest among them is $6$, so the $3$\-rd line in the output should contain $6$.