#include using namespace std; #define int long long #define nl "\n" #define vi vector #define ip(x) \ for (auto &it : x) \ cin >> it #define all(x) x.begin(), x.end() void solve() { int n, k; cin >> n >> k; vector> a(k); for (auto &x : a) { cin >> x.first >> x.second; } sort(a.begin(), a.end(), [&](pair a, pair b) { return a.first > b.first; }); string ans(n, a[0].second); for (int i = 1; i < k; i++) { int x = a[i].first; int need = (x + 1) / 2; for (int j = 0; j < need; j++) { ans[x - j] = a[i].second; } } cout << ans << nl; // for (auto x : a) // { // cout << x.first << " " << x.second << nl; // } } signed main() { ios::sync_with_stdio(false); cin.tie(0); int t = 1; // cin >> t; while (t--) solve(); }