[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]:
declare ok with string t as argument, returning boolean
    declare integer msk = 0
    for i = 0 to integer casted size of t exclusive
        if t[i] is upper case, let msk be msk bitwise or 1
        if t[i] is lower case, let msk be msk bitwise or 2
        if t[i] is digit, let msk be msk bitwise or 4
    end of the block
    return mks is 7
end of the block
define the main function
    declare integer t
    declare string s
    read t
    for i = 0 to t exclusive
        read s
        if result of run ok(s) is true
            print s and newline
            end current loop iteration
        end of the block
        declare boolean fnd = false
        for i = 0 to integer casted size of s exclusive
            deeclare string t = s
            let t[i] be '1'
            if result of run ok(t) is true
                print t, newline
                let fnd be true
                end loop
            end of the block
            let t[i] be 'a'
            if result of run ok(t) is true
                print t, newline
                let fnd be true
                end loop
            end of the block
            let t[i] be 'A'
            if result of run ok(t) is true
                print t, newline
                let fnd be true
                end loop
            end of the block
        end of the block
        if fnd is true, end loop iteration
        if s[2] is upper case
            let s[0] be 'a'
            let s[1] be '1'
            print s, newline
            end loop iteration
        end of the block
        if s[2] is lower case
            let s[0] be 'A'
            let s[1] be '1'
            print s, newline
            end loop iteration
        end of the block
        if s[2] is digit
            let s[0] be 'a'
            let s[1] be 'A'
            print s, newline
            end loop iteration
        end of the block
    end of the block
end of the block

[CODE]:

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;
    string s;
    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;
        }
    }
}