When cooling of ammonia and carbon dioxide gas is started from 500 K, then ammonia reaches its critical temperature first (i.e., 405.5 K.) and hence, it is also the first to get liquefied.
When the cooling is continued further, carbon dioxide gas is liquefied as it reaches its critical temperature (i.e., 304.10 K).