heapq did the job
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:n\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:n\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def nthSuperUglyNumber(self, n: int, primes: List[int]) -> int:\n        hp=[1]\n        dc={1}\n        i=1\n        while(n):\n            mn=heapq.heappop(hp)\n            if(n==1):\n                return mn\n            for p in primes:\n                newno=mn*p\n                if(newno in dc):\n                    continue\n                heapq.heappush(hp,newno)\n                dc.add(newno)\n            n-=1\n```
['Python', 'Python3']