Alex is going to make a set of cubical blocks of the same size and to write a digit on each of their faces so that it would be possible to form every $30$-digit integer with these blocks. What is the minimal number of blocks in a set with this property? (The digits $6$ and $9$ do not turn one into another.)