From what I understand, store and forward works on the principle of storing bits of packets until the whole packet is received and then transmitting them. Also, bits are made to wait in a queue before transmission. Since a router receives multiple packets at the same time, how are the bits of packets arranged in a queue so as to not mix with other packets? Is there a queue of queues?
Packets have headers that either have an explicit packet size, e.g. the IPv4 header Total Length Field, or enough information to calculate the packet size, e.g. the IPv6 Payload length field.
For IPv4, there is RFC 791, Internet Protocol:
3.1. Internet Header Format
A summary of the contents of the internet header follows:
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL |Type of Service| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Example Internet Datagram Header
For IPv6, there is RFC 2460, Internet Protocol, Version 6 (IPv6) Specification:
IPv6 Header Format
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| Traffic Class | Flow Label | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Payload Length | Next Header | Hop Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Source Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | + + | | + Destination Address + | | + + | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Of course, there are/have been other network protocols, but each has something similar.
After a packet is enqueued, it can be dequeued by the router in its entirety, without grabbing bits from other packets because the packet size is known, and only the bits for the packet to be dequeued are removed from the queue and forwarded. This means that different packets in the queue can all be different sizes, and the router will not get but what it needs for a packet, and it will get the entire packet.
The bits are organized in packets and it's up to the discretion of the router to queue and unqueue those packets neatly and without mixing anything up.
Receiving multiple packets from different interfaces is absolutely common but (usually) each packet is passed to the egress queue in a single, atomic operation once it's been received in entirety.
There isn't just a single queue, there are queues per interface, so there isn't any intermingling of the bits in different packets. The packets are stored in the queues as entire packets, with an internal header to hold information such as source interface, VLAN etc. The packets are referenced through pointers to the data that the OS can then use to forward the packet to an egress queue. Sometimes shared buffers are used, which are shared between many interfaces, but again, the packets are stored as whole packets (with headers) and the device keeps track of them through pointers. At the end of the day a queue is just a block of memory that the OS manages.