#include <algorithm>
#include <iostream>
#include <string>

int main(int argc, char *argv[])
{
    constexpr int STATE_SIZE = 2;
    constexpr int CITY_SIZE = 3;

    std::string data[STATE_SIZE/* 2 */][CITY_SIZE /* 3 */] =
    {
        {"ABC", "XYZ", "PQR"},
        {"UHA", "ADC", "GSF"}
    };
    std::string states[STATE_SIZE] = {"AAA", "BBB"};

    for (int i = 0; i != STATE_SIZE; ++i) {
        std::sort(data[i], data[i] + CITY_SIZE);
    }

    for (int i = 0; i != STATE_SIZE; ++i) {
        std::cout << states[i] << std::endl;
        for (int j = 0; j != CITY_SIZE; ++j) {
            std::cout << "    " << data[i][j] << std::endl;
        }
    }

    return 0;
}
