There's no problem, this is expected behavior.
First, if you have more than one core, then the priorities won't matter if there are fewer ready-to-run threads than cores -- each thread will get its own core.
Second, your high-priority thread sleeps, which gives the lower-priority thread time to run.
Third, your threads interact through the lock that protects standard output. The higher-priority thread can be waiting for that lock, allowing lower-priority threads to run.
Please don't try to use priorities this way. It adds massive complexity, hurts performance, and rarely accomplishes anything useful.