Queue-length balance equations in multiclass multiserver queues and their generalizations