[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
make string s
in function ok with return type boolean and parameter string t
    make int msk = 0
    for i = 0 to (cast t size to int) exclusive
        if isupper(t[i]) then set msk to msk bitwise or 1
        if islower(t[i]) then set msk to msk bitwise or1
        if isdigit(t[i]) then set msk to msk bitwise or 1
    end of the block
    return msk is equal to 7
end of the block
define the main function
    make integer t
    read t
    for i = 0 to t exclusive
        read s
        if ok(s)
            print s
            continue
        end of the block
        make boolean fnd = false
        for i = 0 to (cast s size to int) exclusive
            make string t = s
            set t[i] to '1'
            if ok(t)
                print t
                set fnd to true
                break
            end of the block
            set t[i] to 'a'
            if ok(t)
                print t
                set fnd to true
                break
            end of the block
            set t[i] to 'A'
            if ok(t)
                print t
                set fnd to true
                break
            end of the block
        end of the block
        if fnd then continue
        if isupper(s[2])
            set s[0] to 'a'
            set s[1] to '1'
            print s
            continue
        end of the block
        if islower(s[2])
            set s[0] to 'A'
            set s[1] to '1'
            print s
            continue
        end of the block
        if isdigit(s[2])
            set s[0] to 'a'
            set s[1] to 'A'
            print s
            continue
        end of the block
    end of the block
    return to indicate successful execution
end of the block

[CODE]:

string s;
bool ok(string t) {
    int msk = 0;
    for (int i = 0; i < int(t.size()); ++i) {
        if (isupper(t[i])) msk |= 1;
        if (islower(t[i])) msk |= 2;
        if (isdigit(t[i])) msk |= 4;
    }
    return msk == 7;
}
int main() {
    int t;
    cin >> t;
    for (int i = 0; i < t; ++i) {
        cin >> s;
        if (ok(s)) {
            cout << s << endl;
            continue;
        }
        bool fnd = false;
        for (int i = 0; i < int(s.size()); ++i) {
            string t = s;
            t[i] = '1';
            if (ok(t)) {
                cout << t << endl;
                fnd = true;
                break;
            }
            t[i] = 'a';
            if (ok(t)) {
                cout << t << endl;
                fnd = true;
                break;
            }
            t[i] = 'A';
            if (ok(t)) {
                cout << t << endl;
                fnd = true;
                break;
            }
        }
        if (fnd) continue;
        if (isupper(s[2])) {
            s[0] = 'a';
            s[1] = '1';
            cout << s << endl;
            continue;
        }
        if (islower(s[2])) {
            s[0] = 'A';
            s[1] = '1';
            cout << s << endl;
            continue;
        }
        if (isdigit(s[2])) {
            s[0] = 'a';
            s[1] = 'A';
            cout << s << endl;
            continue;
        }
    }
    return 0;
}