How to Block 3rd Level Subdomian With Https Protocol

Hi, we have a task of blocking several subdomains in a network of 3 PCs.

We need to block access to https://x.y.com, https://x.y.co.uk, https://x.y.de … and many other country TLDs. We do not want to block access to https://y.com, only to https://X.y.com

What is the best mikrotik router to do the task?

What is the best way to complete the task efficiently?

Thanks.