In implementation of stack using queue or queue using stack, only one operation can be O(1) and the other has to be O(n).

https://www.geeksforgeeks.org/implement-stack-using-queue/

https://www.geeksforgeeks.org/queue-using-stacks/

Check these links