Stability and throughput for two-layered queueing networks