# [Perl 6], 80 bytes <!-- language-all: lang-perl6 --> {map({|(1,3,9,|('A'..'Z'))[grep :k,*%3==$^v,($_,-+^*div 3...0)]},1,2).join.flip} [Try it online!][TIO-jfbbdf0y] [Perl 6]: https://github.com/nxadm/rakudo-pkg [TIO-jfbbdf0y]: https://tio.run/##DYpLCsIwFACv8hbVfHw@mgSUKll4DcVKwUairQ0RCqXt2WOGWcxiQhu7Q@on2Dqwae6bwOeFKzRY4cLZhRGxKxPi9optgNMH5cZYW9Qj8uKB@10tn34EQ0SluK@oUAt6D/5LrvNhTb9mApdPAW6IUCIohGPW5KwyCFpKo8/pDw "Perl 6 – Try It Online" No separator. Based on [xnor's answer](https://codegolf.stackexchange.com/a/41762/58563).