This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 人外有人,天外有天
// author: Ausp3x
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
typedef long long             lng;
typedef unsigned int          uint;
typedef unsigned long long    ulng;
using namespace std;
using namespace __gnu_pbds;
int const INF32 = 0x3f3f3f3f;
lng const INF64 = 0x3f3f3f3f3f3f3f3f;
vector<string> history(1);
void Init() {
    
    return;
}
void TypeLetter(char l) {
    string res = history.back();
    res += l;
    history.push_back(res);
    return;
}
void UndoCommands(int u) {
    history.push_back(history[history.size() - u - 1]);
    return;
}
char GetLetter(int p) {
    return history.back()[p];
}
/*
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    Init();
    TypeLetter('a');
    TypeLetter('b');
    cout << GetLetter(1) << endl;
    TypeLetter('d');
    UndoCommands(2);
    UndoCommands(1);
    cout << GetLetter(2) << endl;
    TypeLetter('e');
    UndoCommands(1);
    UndoCommands(5);
    TypeLetter('c');
    cout << GetLetter(2) << endl;
    UndoCommands(2);
    cout << GetLetter(2) << endl;
    return 0;
}
//*/
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |