#C3020. Deterministic Deal Cards

    ID: 46402 Type: Default 1000ms 256MiB

Deterministic Deal Cards

Deterministic Deal Cards

Given an integer representing the number of cards to be dealt from a standard deck of 52 cards, your task is to simulate shuffling and dealing these cards.

The deck is initially ordered by suits in the following order: hearts, diamonds, clubs, spades; and within each suit the cards are ordered as: "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King".

To ensure all submissions are deterministic across different languages, use the following shuffling algorithm:

For \(i = 51\) downto \(1\), let \(j = (i \times 37) \bmod (i+1)\) and swap the card at index \(i\) with the card at index \(j\).

If the number of cards requested is more than 52, output Not enough cards to deal.

inputFormat

A single integer \(n\) from stdin, representing the number of cards to deal.

outputFormat

If \(n > 52\), output Not enough cards to deal. Otherwise, output the dealt cards each on a new line in the order obtained after shuffling.

## sample
5
Jack of clubs

6 of diamonds 10 of spades 2 of spades 8 of spades

</p>