#include<bits/stdc++.h>

using namespace std;
using i64 = long long;
using i32 = int;

template<typename T> T load() { T x; cin >> x; return x; }
template<typename T> vector<T> loadN(int s) { vector<T> vt(s); for(auto& el : vt) el = load<T>(); return vt; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vt) { for(auto& el : vt) os << el << ' '; return os; }

struct Graph {
    Graph(int s):edges(s) {}
    struct dummy { template<typename ... Ts> void operator()(Ts&& ...) {} };
    void addEdge(int i, int j) { edges[i].push_back(j); }
    void addBiEdge(i32 i, i32 j) { addEdge(i, j); addEdge(j, i); }
    template<typename PreV = dummy, typename PreE = dummy, typename PostE = dummy, typename FailE = dummy, typename PostV = dummy>
    void allDfs(PreV prev, PreE pree, PostE poste, FailE faile, PostV postv) {
        auto vis = vector<bool>(size());
        for(i32 i = 0 ; i < size() ; ++i)
            if(not vis[i])
                implDfs(i, vis, prev, pree, poste, faile, postv);
    }
    template<typename PreV = dummy, typename PreE = dummy, typename PostE = dummy, typename FailE = dummy, typename PostV = dummy>
    void implDfs(int v, vector<bool>& vis, PreV prev, PreE pree, PostE poste, FailE faile, PostV postv) {
        vis[v] = true;
        prev(v);
        for(auto& to : edges[v]) {
            if(not vis[to])
                pree(v, to), implDfs(to, vis, prev, pree, poste, faile, postv), poste(v,to);
            else
                faile(v, to);
        }
        postv(v);
    }
    template<typename F>
    void tarjan(F f) {
        auto graphSize = size();
        auto ord = vector<i32>(graphSize, -1);
        auto low = vector<i32>(graphSize, -1);
        auto onStack = vector<bool>(graphSize);
        auto S = vector<i32>();
        auto timer = -1;
        allDfs(
            [&](i32 v) { low[v] = ord[v] = ++timer; onStack[v] = true; S.push_back(v); },
            {},
            [&](i32 f, i32 t) { low[f] = min(low[f], low[t]); },
            [&](i32 f, i32 t) { if(onStack[t]) low[f] = min(low[f], ord[t]); },
            [&](i32 v) {
                if(low[v] != ord[v]) return;
                auto popped = -1;
                auto f2 = f();
                do {
                    popped = S.back(); S.pop_back();
                    onStack[popped] = false;
                    f2(popped);
                } while(popped != v);
            }
        );
    }

    int size() { return edges.size(); }
    vector<vector<int>> edges;
};

struct SatSolution {
    bool isValid() const { return solution.size() > 0; }
    bool operator[](i32 idx) const { return solution[idx]; }
    vector<bool> solution;
};

struct SatBuilder {
    SatBuilder(i32 size):relationships(2 * size), size(size) {}
    void addExpression(i32 i, i32 j) { relationships.addEdge(neg(i), j); relationships.addEdge(neg(j), i); }
    void addRelation(i32 i, i32 j) { relationships.addEdge(i, j); }
    i32 neg(i32 val) const { return val + (val >= size ? -size : + size); }
    SatSolution solve() {
        auto sccCounter = -1;
        auto inScc = vector<i32>(2 * size, -1);
        relationships.tarjan([&](){
            ++sccCounter;
            return [&](i32 v) {
                inScc[v] = sccCounter;
            };
        });
        for(i32 i = 0 ; i < size ; ++i)
            if(inScc[i] == inScc[i + size])
                return SatSolution{vector<bool>()};

        auto solution = vector<bool>(size);

        for(i32 i = 0 ; i < size ; ++i)
            solution[i] = inScc[i] < inScc[i + size];
        return SatSolution{ move(solution) };
    }
    Graph relationships;
    i32 size;
};

struct Edge {
    i32 i, j;
};
template<> Edge load() { Edge x; x.i = load<i32>() - 1; x.j = load<i32>() - 1; if(x.i > x.j) swap(x.i, x.j); return x; }

bool collides(Edge foo, Edge bar) {
    if(foo.i > bar.i)
        swap(foo, bar);
    return foo.i < bar.i && bar.i < foo.j && foo.j < bar.j;
}

int main() {
    ios::sync_with_stdio(false);
    auto ringSize = load<i32>();
    auto edgeNum = load<i32>();
    auto edges = loadN<Edge>(edgeNum);
    auto sat = SatBuilder(edgeNum);
    for(i32 i = 0 ; i < edgeNum ; ++i) {
        for(i32 j = i + 1 ; j < edgeNum ; ++j) {
            if(collides(edges[i], edges[j])) {
                sat.addExpression(i, j);
                sat.addExpression(sat.neg(i), sat.neg(j));
            }
        }
    }
    auto sol = sat.solve();
    if(sol.isValid()) {
        for(i32 i = 0 ; i < edgeNum ; ++i)
            cout << (sol[i] ? 'i' : 'o');
        cout << '\n';
    }
    else {
        cout << "Impossible\n";
    }

}


// Alfonso2 Peterssen (mukel)
#include <bits/stdc++.h>
using namespace std;

#define ALL(c) (c).begin(), (c).end()

struct SAT2 {
  const int V;
  vector<vector<int>> G;
	SAT2(int V) : V(V), G(2 * V) {}
  int NOT(int x) { return (x < V) ? (x + V) : (x - V); }
	void add_or(int u, int v) { G[NOT(u)].push_back(v); G[NOT(v)].push_back(u); }
	void add_implies(int u, int v) { G[u].push_back(v); G[NOT(v)].push_back(NOT(u)); }
	void add_same(int u, int v) { add_implies(u, v); add_implies(v, u); }
	void add_xor(int u, int v) { add_or(u, v); add_or(NOT(u), NOT(v)); }
  void add_set(int u, bool value) { if (!value) { u = NOT(u); } add_or(u, u); }
	bool solve(vector<bool>& out) {
    int discover_time = 0, scc_count = 0;
    vector<int> dfsnum(2 * V), low(2 * V), scc(2 * V);
    stack<int> stk;
    function<void(int)> dfs = [&](int u) {
      low[u] = dfsnum[u] = ++discover_time;
      stk.push(u);
      for (int v : G[u]) {
        if (!dfsnum[v]) {
          dfs(v);
          low[u] = min(low[u], low[v]);
        } else {
          if (!scc[v]) {
            low[u] = min(low[u], dfsnum[v]);
          }
        }
      }
      if (low[u] == dfsnum[u]) {
        for (++scc_count; !scc[u]; stk.pop()) {
          scc[stk.top()] = scc_count;
        }
      }
    };
		out.assign(V, false);
		for (int u = 0; u < V; ++u) {
			if (!dfsnum[u]) { dfs(u); }
			if (!dfsnum[NOT(u)]) { dfs(NOT(u)); }
			if (scc[u] == scc[NOT(u)]) { return false; }
			out[u] = (scc[u] < scc[NOT(u)]);
		}
		return true;
	}
};

int main() {
	cin.sync_with_stdio(0);
  cin.tie(nullptr);

	int N, M; cin >> N >> M;
  vector<pair<int, int>> edges;
	for (int i = 0; i < M; ++i) {
		int u, v;
    cin >> u >> v;
		--u;
		--v;
    edges.push_back({min(u, v), max(u, v)});
	}

  SAT2 sat2(M);
  for (int i = 0; i < M; ++i) {
    for (int j = 0; j < M; ++j) {
      auto [loi, hii] = edges[i];
      auto [loj, hij] = edges[j];
      if ((loi < loj && loj < hii) || (loi < hij && hij < hii)
        || (loj < loi && loi < hij) || (loj < hii && hii < hij)) {
        sat2.add_xor(i, j);
      }
    }
  }

  vector<bool> ans;
	if (sat2.solve(ans)) {
		for (int i = 0; i < M; ++i) {
			cout << (ans[i] ? 'o' : 'i');
    }
    cout << "\n";
	} else {
		cout << "Impossible\n";
  }

	return 0;
}


// Alfonso2 Peterssen (mukel)
#include <bits/stdc++.h>
using namespace std;

#define ALL(c) (c).begin(), (c).end()

struct SAT2 {
  const int V;
  vector<vector<int>> G;
  SAT2(int V) : V(V), G(2 * V) {}
  int NOT(int x) { return (x < V) ? (x + V) : (x - V); }
  void add_or(int u, int v) { G[NOT(u)].push_back(v); G[NOT(v)].push_back(u); }
  void add_implies(int u, int v) { G[u].push_back(v); G[NOT(v)].push_back(NOT(u)); }
  void add_same(int u, int v) { add_implies(u, v); add_implies(v, u); }
  void add_xor(int u, int v) { add_or(u, v); add_or(NOT(u), NOT(v)); }
  void add_set(int u, bool value) { if (!value) { u = NOT(u); } add_or(u, u); }
  bool solve(vector<bool>& out) {
    int discover_time = 0, scc_count = 0;
    vector<int> dfsnum(2 * V), low(2 * V), scc(2 * V);
    stack<int> stk;
    function<void(int)> dfs = [&](int u) {
      low[u] = dfsnum[u] = ++discover_time;
      stk.push(u);
      for (int v : G[u]) {
        if (!dfsnum[v]) {
          dfs(v);
          low[u] = min(low[u], low[v]);
        } else {
          if (!scc[v]) {
            low[u] = min(low[u], dfsnum[v]);
          }
        }
      }
      if (low[u] == dfsnum[u]) {
        for (++scc_count; !scc[u]; stk.pop()) {
          scc[stk.top()] = scc_count;
        }
      }
    };
    out.assign(V, false);
    for (int u = 0; u < V; ++u) {
      if (!dfsnum[u]) { dfs(u); }
      if (!dfsnum[NOT(u)]) { dfs(NOT(u)); }
      if (scc[u] == scc[NOT(u)]) { return false; }
      out[u] = (scc[u] < scc[NOT(u)]);
    }
    return true;
  }
};

int main() {
  cin.sync_with_stdio(0);
  cin.tie(nullptr);

  int N, M; cin >> N >> M;
  vector<pair<int, int>> edges;
  for (int i = 0; i < M; ++i) {
    int u, v;
    cin >> u >> v;
    --u;
    --v;
    edges.push_back({min(u, v), max(u, v)});
  }

  SAT2 sat2(M);
  for (int i = 0; i < M; ++i) {
    for (int j = 0; j < M; ++j) {
      auto [loi, hii] = edges[i];
      auto [loj, hij] = edges[j];
      if ((loi < loj && loj < hii && hij > hii) ||
          (loi < hij && hij < hii && loj < loi)) {
        sat2.add_xor(i, j);
      }
    }
  }

  vector<bool> ans;
  if (sat2.solve(ans)) {
    for (int i = 0; i < M; ++i) {
      cout << (ans[i] ? 'o' : 'i');
    }
    cout << "\n";
  } else {
    cout << "Impossible\n";
  }

  return 0;
}


// Alfonso2 Peterssen (mukel)
#include <bits/stdc++.h>
using namespace std;

#define ALL(c) (c).begin(), (c).end()

struct SAT2 {
  const int V;
  vector<vector<int>> G;
	SAT2(int V) : V(V), G(2 * V) {}
  int NOT(int x) { return (x < V) ? (x + V) : (x - V); }
	void add_or(int u, int v) { G[NOT(u)].push_back(v); G[NOT(v)].push_back(u); }
	void add_implies(int u, int v) { G[u].push_back(v); G[NOT(v)].push_back(NOT(u)); }
	void add_same(int u, int v) { add_implies(u, v); add_implies(v, u); }
	void add_xor(int u, int v) { add_or(u, v); add_or(NOT(u), NOT(v)); }
  void add_set(int u, bool value) { if (!value) { u = NOT(u); } add_or(u, u); }
	bool solve(vector<bool>& out) {
    int discover_time = 0, scc_count = 0;
    vector<int> dfsnum(2 * V), low(2 * V), scc(2 * V);
    stack<int> stk;
    function<void(int)> dfs = [&](int u) {
      low[u] = dfsnum[u] = ++discover_time;
      stk.push(u);
      for (int v : G[u]) {
        if (!dfsnum[v]) {
          dfs(v);
          low[u] = min(low[u], low[v]);
        } else {
          if (!scc[v]) {
            low[u] = min(low[u], dfsnum[v]);
          }
        }
      }
      if (low[u] == dfsnum[u]) {
        for (++scc_count; !scc[u]; stk.pop()) {
          scc[stk.top()] = scc_count;
        }
      }
    };
		out.assign(V, false);
		for (int u = 0; u < V; ++u) {
			if (!dfsnum[u]) { dfs(u); }
			if (!dfsnum[NOT(u)]) { dfs(NOT(u)); }
			if (scc[u] == scc[NOT(u)]) { return false; }
			out[u] = (scc[u] < scc[NOT(u)]);
		}
		return true;
	}
};

int main() {
	cin.sync_with_stdio(0);
  cin.tie(nullptr);

	int N, M; cin >> N >> M;
  vector<pair<int, int>> edges;
	for (int i = 0; i < M; ++i) {
		int u, v;
    cin >> u >> v;
		--u;
		--v;
    edges.push_back({min(u, v), max(u, v)});
	}

  SAT2 sat2(M);
  for (int i = 0; i < M; ++i) {
    for (int j = 0; j < M; ++j) {
      auto [loi, hii] = edges[i];
      auto [loj, hij] = edges[j];
      if ((loi < loj && loj < hii) || (loi < hij && hij < hii)) {
        sat2.add_xor(i, j);
      }
    }
  }

  vector<bool> ans;
	if (sat2.solve(ans)) {
		for (int i = 0; i < M; ++i) {
			cout << (ans[i] ? 'o' : 'i');
    }
    cout << "\n";
	} else {
		cout << "Impossible\n";
  }

	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef int ll;
typedef long double  ld;
#define pii pair<ll,ll>
#define vi vector< ll >
#define vvi vector< vi >
#define vpi vector< pii >
#define vvpi vector< vpi >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define test(t) ll t;cin>>t;while(t--)
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#define debarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}

const int MAXN = 262144;
class TwoSat {
public:
   int n, mark[MAXN];
   int stk[MAXN], stkIdx;
   vector<int> g[MAXN];

   void impl(int u, int v){g[u].push_back(v);}
   void V(int x, int y) { impl(x^1, y); impl(y^1, x); }
   void eq(int x, int y) { impl(x, y); impl(y, x); impl(x^1, y^1); impl(y^1, x^1); }
   void tru(int x) { impl(x^1, x); }
   int dfs(int u) {
       if (mark[u^1])  return 0;
       if (mark[u])    return 1;
       mark[u] = 1, stk[++stkIdx] = u;
       for (int i = 0; i < g[u].size(); i++) {
           int v = g[u][i];
           if (!dfs(v))
               return false;
       }
       return true;
   }
   int solvable() {
       for(int i = 0; i < n; i += 2) {
           if (mark[i] == 0 && mark[i+1] == 0) {
               stkIdx = -1;
               if (!dfs(i)) {
                   while (stkIdx >= 0)mark[stk[stkIdx]] = 0, stkIdx--;
                   if (!dfs(i+1))return 0;
               }
           }
       }
       return 1;
   }
   void init(int n) {
       this->n = n;
       for (int i = 0; i < n; i++)
           g[i].clear(), mark[i] = 0;
   }
}g;
bool intersect(ll a,ll b,ll aa,ll bb,ll n)
{
    if(a>b)
        swap(a,b);
    if(aa>bb)
        swap(aa,bb);
    ll i;
    ll cnt = 0;
    for(ll i=a;i<=b;i++)
    {
        if(i==aa or i==bb)
            cnt++;
    }
    cnt%=2;
    i = b;
    ll x = 0;
    while(1)
    {
        if(i==aa or i==bb)
            x++;
        if(i==a)
            break;
        if(i==n)
            i = 1;
        else
            i++;
    }
    x = x%2;
    cnt = cnt&x;
    // pr(a,b,aa,bb,cnt);
    return cnt;
}
signed main()
{
    fast;
    ll n,m;
    cin>>n>>m;
    g.init(2*m);
    vvi arr(m);
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        ll j;
        for(j=0;j<i;j++)
        {
            ll aa = arr[j][0],bb = arr[j][1];
            if(intersect(a,b,aa,bb,n))
            {
                ll door1 = i*2;
                ll door2 = j*2;
                g.V(door1,door2);
                g.V(door1+1,door2+1);

            }
        }
        arr[i].pb(a);
        arr[i].pb(b);
    }

    vector < int > lol;
    if(g.solvable()) {
        for(ll i=0;i<2*m;i+=2)
        {
            if(g.mark[i])
            cout<<"o";
            else
            cout<<"i";
        }
    }
    else
        cout<<"Impossible";
}


#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef int ll;
typedef long double  ld;
#define pii pair<ll,ll>
#define vi vector< ll >
#define vvi vector< vi >
#define vpi vector< pii >
#define vvpi vector< vpi >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define test(t) ll t;cin>>t;while(t--)
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#define debarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
struct TwoSAT
{
    static const int MAXV=2e5+5;

    int n, cnt;
    vector<int> g[MAXV], rg[MAXV]; //g=forward, rg=backward
    bool vis[MAXV];
    int order[MAXV], comp[MAXV];

    void init(int curn)
    {
        n=curn;
        for(int i=0;i<n;i++)
        {
            g[i].clear();
            rg[i].clear();
        }
    }

    void add(int u, int v)
    {
        g[u].push_back(v);
        rg[v].push_back(u);
    }

    void dfs1(int u)
    {
        vis[u] = true;
        for(auto it:g[u])
            if(!vis[it])
                dfs1(it);
        order[cnt++] = u;
    }

    void dfs2(int u, int c)
    {
        comp[u] = c;
        for(auto it:rg[u])
            if(comp[it]==-1)
                dfs2(it, c);
    }

    int solve(vector<int> &ans)
    {
        cnt=0;
        memset(vis, 0, sizeof(vis));
        for(int i=0;i<n;i++)
            if(!vis[i])
                dfs1(i);
        memset(comp, -1, sizeof(comp));
        int grp=0;
        for(int i=n-1;i>=0;i--)
        {
            int u=order[i];
            if(comp[u] == -1)
                dfs2(u, grp++);
        }

        for(int i=0;i<n;i+=2)
            if(comp[i]==comp[i^1])
                return 0;

        ans.clear();

        for(int i=0;i<n;i+=2)
        {
            int choose = (comp[i] > comp[i^1]) ? i : (i^1);
            ans.push_back(choose);
        }

        return 1;
    }
}g;
bool intersect(ll a,ll b,ll aa,ll bb,ll n)
{
    if(a>b)
        swap(a,b);
    if(aa>bb)
        swap(aa,bb);
    ll i;
    ll cnt = 0;
    for(ll i=a;i<=b;i++)
    {
        if(i==aa or i==bb)
            cnt++;
    }
    cnt%=2;
    i = b;
    ll x = 0;
    while(1)
    {
        if(i==aa or i==bb)
            x++;
        if(i==a)
            break;
        if(i==n)
            i = 1;
        else
            i++;
    }
    x = x%2;
    cnt = cnt&x;
    // pr(a,b,aa,bb,cnt);
    return cnt;
}
signed main()
{
    fast;
    ll n,m;
    cin>>n>>m;
    g.init(2*m);
    vvi arr(m);
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        ll j;
        for(j=0;j<i;j++)
        {
            ll aa = arr[j][0],bb = arr[j][1];
            if(intersect(a,b,aa,bb,n))
            {
                ll door1 = i*2;
                ll door2 = j*2;
                g.add(door1,door2+1);
                g.add(door2,door1+1);
                g.add(door1+1,door2);
                g.add(door2+1,door1);
            }
        }
        arr[i].pb(a);
        arr[i].pb(b);
    }

    vector < int > lol;
    if(g.solve(lol)) {
        for(auto v:lol)
        {
            if(v%2)
            cout<<"o";
            else
            cout<<"i";
        }
    }
    else
        cout<<"Impossible";
}


#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
typedef int ll;
typedef long double  ld;
#define pii pair<ll,ll>
#define vi vector< ll >
#define vvi vector< vi >
#define vpi vector< pii >
#define vvpi vector< vpi >
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define test(t) ll t;cin>>t;while(t--)
#define mem(a,b) memset(a,b,sizeof(a))
#define inn freopen("input.txt", "r", stdin)
#define outt freopen("output.txt", "w", stdout)
#define all(arr) arr.begin(),arr.end()
#define fr(i,n) for(ll i=0;i<(n);++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define remin(a,b) (a=min((a),(b)))
#define remax(a,b) (a=max((a),(b)))
#define debarr(a,n) cerr<<#a<<" : ";for(ll i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define debmat(mat,row,col) cerr<<#mat<<" :\n";for(ll i=0;i<row;i++) {for(ll j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {ll idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
ll power(ll x,ll y){ll res = 1;while(y){if(y&1) res = (res*x)%mod;y=y/2,x=(x*x)%mod;}return res%mod;}
struct TwoSAT
{
    static const int MAXV=2e5+5;

    int n, cnt;
    vector<int> g[MAXV], rg[MAXV]; //g=forward, rg=backward
    bool vis[MAXV];
    int order[MAXV], comp[MAXV];

    void init(int curn)
    {
        n=curn;
        for(int i=0;i<n;i++)
        {
            g[i].clear();
            rg[i].clear();
        }
    }

    void add(int u, int v)
    {
        g[u].push_back(v);
        rg[v].push_back(u);
    }

    void dfs1(int u)
    {
        vis[u] = true;
        for(auto it:g[u])
            if(!vis[it])
                dfs1(it);
        order[cnt++] = u;
    }

    void dfs2(int u, int c)
    {
        comp[u] = c;
        for(auto it:rg[u])
            if(comp[it]==-1)
                dfs2(it, c);
    }

    int solve(vector<int> &ans)
    {
        cnt=0;
        memset(vis, 0, sizeof(vis));
        for(int i=0;i<n;i++)
            if(!vis[i])
                dfs1(i);
        memset(comp, -1, sizeof(comp));
        int grp=0;
        for(int i=n-1;i>=0;i--)
        {
            int u=order[i];
            if(comp[u] == -1)
                dfs2(u, grp++);
        }

        for(int i=0;i<n;i+=2)
            if(comp[i]==comp[i^1])
                return 0;

        ans.clear();

        for(int i=0;i<n;i+=2)
        {
            int choose = (comp[i] > comp[i^1]) ? i : (i^1);
            ans.push_back(choose);
        }

        return 1;
    }
}g;
bool intersect(ll a,ll b,ll aa,ll bb)
{
    if(a>b)
        swap(a,b);
    if(aa>bb)
        swap(aa,bb);
    ll i;
    ll cnt = 0;
    for(ll i=a;i<=b;i++)
    {
        if(i==aa or i==bb)
            cnt++;
    }
    cnt%=2;
    return cnt;
}
signed main()
{
    fast;
    ll n,m;
    cin>>n>>m;
    g.init(2*m);
    vvi arr(m);
    for(ll i=0;i<m;i++)
    {
        ll a,b;
        cin>>a>>b;
        ll j;
        for(j=0;j<i;j++)
        {
            ll aa = arr[j][0],bb = arr[j][1];
            if(intersect(a,b,aa,bb))
            {
                ll door1 = i*2;
                ll door2 = j*2;
                g.add(door1,door2+1);
                g.add(door2,door1+1);
                g.add(door1+1,door2);
                g.add(door2+1,door1);
            }
        }
        arr[i].pb(a);
        arr[i].pb(b);
    }

    vector < int > lol;
    if(g.solve(lol)) {
        for(auto v:lol)
        {
            if(v%2)
            cout<<"o";
            else
            cout<<"i";
        }
    }
    else
        cout<<"Impossible";
}


#include "bits/stdc++.h"

using namespace std;

const int N = 201;

vector<int> g[N], g_inv[N];
vector<pair<int, int>> edges;

inline void add(int i, int j) {
    g[i << 1].push_back((j << 1) ^ 1);
    g[j << 1].push_back((i << 1) ^ 1);
    g[(i << 1) ^ 1].push_back(j << 1);
    g[(j << 1) ^ 1].push_back(i << 1);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    edges.reserve(m);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b)
            swap(a, b);
        edges.emplace_back(a, b);
    }
    for (int i = 0; i < m; ++i) {
        for (int j = i + 1; j < m; ++j) {
            auto &a = edges[i];
            auto &b = edges[j];
            if ((a.first < b.first && a.second > b.first && a.second < b.second) ||
                (a.first > b.first && b.second > a.first && b.second < a.second))
            {
                add(i, j);
            }
        }
    }
    for (int i = 0; i < 2 * m; ++i) {
        for (auto x : g[i]) {
            g_inv[x].push_back(i);
        }
    }
    vector<bool> vis(2 * m, false);
    vector<int> order;
    function<void(int)> dfs1 = [&](int node) {
        vis[node] = true;
        for (auto x : g[node]) {
            if (!vis[x]) {
                dfs1(x);
            }
        }
        order.push_back(node);
    };
    for (int i = 0; i < 2 * m; ++i) {
        if (!vis[i]) {
            dfs1(i);
        }
    }
    vector<int> comp_id(2 * m);
    vector<int> comp_head(2 * m);
    int id = 0;
    function<void(int)> dfs2 = [&](int node) {
        vis[node] = true;
        comp_id[node] = id;
        for (auto x : g_inv[node]) {
            if (!vis[x]) {
                dfs2(x);
            }
        }
    };
    vector<int> temp = order;
    vis.assign(2 * m, false);
    while (!temp.empty()) {
        int top = temp.back();
        temp.pop_back();
        if (!vis[top]) {
            comp_head[id] = top;
            dfs2(top);
            ++id;
        }
    }
    vector<int> ans(id, -1);
    for (int i = 0; i < id; ++i) {
        if (ans[i] == -1) {
            ans[i] = true;
            if (ans[comp_id[comp_head[i] ^ 1]] == true) {
                cout << -1 << '\n';
                return 0;
            }
            ans[comp_id[comp_head[i] ^ 1]] = false;
        }
    }
    for (int i = 0; i < m; ++i) {
        int x = ans[comp_id[i << 1]];
        cout << (x ? 'i' : 'o');
    }
    cout << '\n';
    return 0;
}


#include "bits/stdc++.h"

using namespace std;

const int N = 201;

vector<int> g[N], g_inv[N];
vector<pair<int, int>> edges;

inline void add(int i, int j) {
    g[i << 1].push_back((j << 1) ^ 1);
    g[j << 1].push_back((i << 1) ^ 1);
    g[(i << 1) ^ 1].push_back(j << 1);
    g[(j << 1) ^ 1].push_back(i << 1);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    edges.reserve(m);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b)
            swap(a, b);
        edges.emplace_back(a, b);
    }
    for (int i = 0; i < m; ++i) {
        for (int j = i + 1; j < m; ++j) {
            auto &a = edges[i];
            auto &b = edges[j];
            if ((a.first < b.first && a.second > b.first && a.second < b.second) ||
                (a.first > b.first && b.second > a.first && b.second < a.second))
            {
                add(i, j);
            }
        }
    }
    for (int i = 0; i < 2 * m; ++i) {
        for (auto x : g[i]) {
            g_inv[x].push_back(i);
        }
    }
    vector<bool> vis(2 * m, false);
    vector<int> order;
    function<void(int)> dfs1 = [&](int node) {
        vis[node] = true;
        for (auto x : g[node]) {
            if (!vis[x]) {
                dfs1(x);
            }
        }
        order.push_back(node);
    };
    for (int i = 0; i < 2 * m; ++i) {
        if (!vis[i]) {
            dfs1(i);
        }
    }
    vector<int> comp_id(2 * m);
    vector<int> comp_head(2 * m);
    int id = 0;
    function<void(int)> dfs2 = [&](int node) {
        vis[node] = true;
        comp_id[node] = id;
        for (auto x : g_inv[node]) {
            if (!vis[x]) {
                dfs2(x);
            }
        }
    };
    vector<int> temp = order;
    vis.assign(2 * m, false);
    while (!temp.empty()) {
        int top = temp.back();
        temp.pop_back();
        if (!vis[top]) {
            comp_head[id] = top;
            dfs2(top);
            ++id;
        }
    }
    vector<int> ans(id, -1);
    for (int i = 0; i < id; ++i) {
        if (ans[i] == -1) {
            ans[i] = true;
            if (ans[comp_id[comp_head[i] ^ 1]] == true) {
                cout << -1 << '\n';
                return 0;
            }
            ans[comp_id[comp_head[i] ^ 1]] = false;
        }
    }
    for (int i = 0; i < m; ++i) {
        int x = ans[comp_id[i << 1]];
        cout << (x ? 'i' : 'o');
    }
    cout << '\n';
    return 0;
}


#include "bits/stdc++.h"

using namespace std;

const int N = 201;

vector<int> g[N], g_inv[N];
vector<pair<int, int>> edges;

inline void add(int i, int j) {
    g[i << 1].push_back((j << 1) ^ 1);
    g[j << 1].push_back((i << 1) ^ 1);
    g[(i << 1) ^ 1].push_back(j << 1);
    g[(j << 1) ^ 1].push_back(i << 1);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    edges.reserve(m);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        if (a > b)
            swap(a, b);
        edges.emplace_back(a, b);
    }
    for (int i = 0; i < m; ++i) {
        for (int j = i + 1; j < m; ++j) {
            auto &a = edges[i];
            auto &b = edges[j];
            if ((a.first < b.first && a.second > b.first && a.second < b.second) ||
                (a.first > b.first && b.second > a.first && b.second < a.second))
            {
                add(i, j);
            }
        }
    }
    for (int i = 0; i < 2 * m; ++i) {
        for (auto x : g[i]) {
            g_inv[x].push_back(i);
        }
    }
    vector<bool> vis(2 * m, false);
    vector<int> order;
    function<void(int)> dfs1 = [&](int node) {
        vis[node] = true;
        for (auto x : g[node]) {
            if (!vis[x]) {
                dfs1(x);
            }
        }
        order.push_back(node);
    };
    for (int i = 0; i < 2 * m; ++i) {
        if (!vis[i]) {
            dfs1(i);
        }
    }
    vector<int> comp_id(2 * m);
    vector<int> comp_head(2 * m);
    int id = 0;
    function<void(int)> dfs2 = [&](int node) {
        vis[node] = true;
        comp_id[node] = id;
        for (auto x : g_inv[node]) {
            if (!vis[x]) {
                dfs2(x);
            }
        }
    };
    vector<int> temp = order;
    vis.assign(2 * m, false);
    while (!temp.empty()) {
        int top = temp.back();
        temp.pop_back();
        if (!vis[top]) {
            comp_head[id] = top;
            dfs2(top);
            ++id;
        }
    }
    vector<int> ans(id, -1);
    for (int i = 0; i < id; ++i) {
        if (ans[i] == -1) {
            ans[i] = true;
            if (ans[comp_id[comp_head[i] ^ 1]] == true) {
                cout << "Impossible\n"; // ffs
                return 0;
            }
            ans[comp_id[comp_head[i] ^ 1]] = false;
        }
    }
    for (int i = 0; i < m; ++i) {
        int x = ans[comp_id[i << 1]];
        cout << (x ? 'i' : 'o');
    }
    cout << '\n';
    return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef pair<int, int> pii;
#define u first
#define v second

#define MAXV 100000

typedef vector<int> vi;
vi g[MAXV];

int n, m;

int ans[MAXV];
int color[MAXV];
int parent[MAXV];
int id[MAXV];
int sz;
vector<int> s;

vector<int> ord;

void t_dfs(int v, int &d){
	parent[v] = d++;
	int d_ = parent[v];
	s.push_back(v);
	color[v] = 1;
	for (int w : g[v]){
		if (color[w] == 2) continue;
		if (color[w] == 0)
			t_dfs(w, d);
		parent[v] = min(parent[v], parent[w]);
	}
	if (parent[v] != d_) return;
	int id_ = sz++;
	while (true){
		int x = s.back();
		s.pop_back();
		color[x] = 2;
		id[x] = id_;
		ord.push_back(x);
		if (x == v) break;
	}
}

void tarjan(int n){
	memset(color, 0, sizeof color);
	memset(parent, 0, sizeof parent);
	memset(ans, 0, sizeof ans);
	s.resize(0);
	sz = 0;
	int d = 1;
	for (int i = 0; i < n; i++)
		if (color[i] == 0) t_dfs(i, d);
}

int main(){ _
	cin >> n >> m;
	pii e[110];
	for (int i = 0; i < m; i++){
		cin >> e[i].u >> e[i].v;
		if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
	}
	sort(e, e+m);
	for (int i = 0; i < m; i++){
		for (int j = i+1; j < m; j++){
			if ((e[i].u < e[j].u) && (e[j].u < e[i].v) && (e[i].v < e[j].v)){
				g[i].push_back(j+m);
				g[i+m].push_back(j);
				g[j].push_back(i+m);
				g[j+m].push_back(i);
			}
		}
	}
	tarjan(2*m);
	memset(ans, 0, sizeof ans);
	for (int i = ord.size()-1; i >= 0; i--){
		int var = ord[i];
		if (var >= m){
			if (ans[var-m]) continue;
			ans[var] = true;
		}
		else{
			if (ans[var+m]) continue;
			ans[var] = true;
		}
	}
	for (int i = 0; i < m; i++){
		if (ans[i]) cout << 'i';
		else cout << 'o';
	}
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef pair<int, int> pii;
#define u first
#define v second

#define MAXV 100000

typedef vector<int> vi;
vi g[MAXV];

int n, m;

int ans[MAXV];
int color[MAXV];
int parent[MAXV];
int id[MAXV];
int sz;
vector<int> s;

void t_dfs(int v, int &d){
	parent[v] = d++;
	int d_ = parent[v];
	s.push_back(v);
	color[v] = 1;
	for (int w : g[v]){
		if (color[w] == 2) continue;
		if (color[w] == 0)
			t_dfs(w, d);
		parent[v] = min(parent[v], parent[w]);
	}
	if (parent[v] != d_) return;
	int id_ = sz++;
	while (true){
		int x = s.back();
		s.pop_back();
		color[x] = 2;
		id[x] = id_;

		int var = x < m ? x : x-m;
		if (!ans[var] && !ans[var+m])
			ans[x] = true;
		if (x == v) break;
	}
}

void tarjan(int n){
	memset(color, 0, sizeof color);
	memset(parent, 0, sizeof parent);
	memset(ans, 0, sizeof ans);
	s.resize(0);
	sz = 0;
	int d = 1;
	for (int i = 0; i < n; i++)
		if (color[i] == 0) t_dfs(i, d);
}

int main(){ _
	cin >> n >> m;
	pii e[110];
	for (int i = 0; i < m; i++){
		cin >> e[i].u >> e[i].v;
		if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
	}
	sort(e, e+m);
	for (int i = 0; i < m; i++){
		for (int j = i+1; j < m; j++){
			if ((e[i].u < e[j].u) && (e[j].u < e[i].v) && (e[i].v < e[j].v)){
				g[i].push_back(j+m);
				g[i+m].push_back(j);
				g[j].push_back(i+m);
				g[j+m].push_back(i);
			}
		}
	}
	tarjan(2*m);
	for (int i = 0; i < m; i++){
		if (ans[i]) cout << 'i';
		else cout << 'o';
	}
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef pair<int, int> pii;
#define u first
#define v second

#define MAXV 100000

typedef vector<int> vi;
vi g[MAXV];

int n, m;

int ans[MAXV];
int color[MAXV];
int parent[MAXV];
int id[MAXV];
int sz;
vector<int> s;

vector<int> ord;

void t_dfs(int v, int &d){
	parent[v] = d++;
	int d_ = parent[v];
	s.push_back(v);
	color[v] = 1;
	for (int w : g[v]){
		if (color[w] == 2) continue;
		if (color[w] == 0)
			t_dfs(w, d);
		parent[v] = min(parent[v], parent[w]);
	}
	if (parent[v] != d_) return;
	int id_ = sz++;
	while (true){
		int x = s.back();
		s.pop_back();
		color[x] = 2;
		id[x] = id_;
		ord.push_back(x);
		if (x == v) break;
	}
}

void tarjan(int n){
	memset(color, 0, sizeof color);
	memset(parent, 0, sizeof parent);
	memset(ans, 0, sizeof ans);
	s.resize(0);
	sz = 0;
	int d = 1;
	for (int i = 0; i < n; i++)
		if (color[i] == 0) t_dfs(i, d);
}

int main(){ _
	cin >> n >> m;
	pii e[110];
	for (int i = 0; i < m; i++){
		cin >> e[i].u >> e[i].v;
		if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
	}
	for (int i = 0; i < m; i++){
		for (int j = i+1; j < m; j++){
			pii l = min(e[i], e[j]);
			pii r = max(e[i], e[j]);
			//cout << l.u << " " << l.v << "vs";
			//cout << r.u << " " << r.v << endl;
			if ((l.u < r.u) && (r.u < l.v) && (l.v < r.v)){
				//cout << "TRUE" << endl
				g[i].push_back(j+m);
				g[i+m].push_back(j);
				g[j].push_back(i+m);
				g[j+m].push_back(i);
			}
		}
	}
	tarjan(2*m);
	memset(ans, 0, sizeof ans);
	for (int i = ord.size()-1; i >= 0; i--){
		int var = ord[i];
		if (var >= m){
			if (ans[var-m]) continue;
			ans[var] = true;
		}
		else{
			if (ans[var+m]) continue;
			ans[var] = true;
		}
	}
	for (int i = 0; i < m; i++){
		if (ans[i]) cout << 'i';
		else cout << 'o';
	}
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef pair<int, int> pii;
#define u first
#define v second

typedef vector<int> vi;

#define MAXV 100000

int n, m;

vi g[MAXV];
int color[MAXV];
int parent[MAXV];
int id[MAXV];
int sz;
vector<int> s;

int ans[MAXV];
void t_dfs(int v, int &d){
	parent[v] = d++;
	int d_ = parent[v];
	s.push_back(v);
	color[v] = 1;
	for (int w : g[v]){
		if (color[w] == 2) continue;
		if (color[w] == 0)
			t_dfs(w, d);
		parent[v] = min(parent[v], parent[w]);
	}
	if (parent[v] != d_) return;
	int id_ = sz++;
	while (true){
		int x = s.back();
		s.pop_back();
		color[x] = 2;
		id[x] = id_;
		int variable = (x>m) ? (x-m) : x;
		if (!ans[variable] && !ans[variable+m]){
			ans[x] = 1;
		}
		//cout << x << endl;
		if (x == v) break;
	}
	//cout << endl;
}

void tarjan(int n){
	memset(color, 0, sizeof color);
	memset(parent, 0, sizeof parent);
	memset(ans, 0, sizeof ans);
	s.resize(0);
	sz = 0;
	int d = 1;
	for (int i = 0; i < n; i++)
		if (color[i] == 0) t_dfs(i, d);
}

vi dag[MAXV];
bool reach(int l, int r){
	if (l == r) return true;
	for (int n : dag[l])
		if (reach(n, r)) return true;
	return false;
}

int main(){ _
	cin >> n >> m;
	pii e[110];
	for (int i = 0; i < m; i++){
		cin >> e[i].u >> e[i].v;
		if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
	}
	sort(e, e+m);
	for (int i = 0; i < m; i++){
		//g[i].push_back(i+m);
		for (int j = i+1; j < m; j++){
			//cout << e[i].u << " " << e[i].v << "vs" << e[j].u << " " << e[j].v << endl;
			if ((e[i].u < e[j].u) && (e[j].u < e[i].v) && (e[i].v < e[j].v)){
				//cout << "TRUE" << endl;
				//cout << i+m << "~" << j << endl;
				//cout << j+m << "~" << i << endl;
				g[i].push_back(j+m);
				g[i+m].push_back(j);
				g[j].push_back(i+m);
				g[j+m].push_back(i);
			}
		}
	}
	tarjan(2*m);
	for (int i = 0; i < m; i++){
		if (ans[id[i]]) cout << 'i';
		else cout << 'o';
	}
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;

typedef pair<int, int> pii;
#define u first
#define v second

#define MAXV 100000

typedef vector<int> vi;
vi g[MAXV];

int n, m;

int ans[MAXV];
int color[MAXV];
int parent[MAXV];
int id[MAXV];
int sz;
vector<int> s;

vector<int> ord;

void t_dfs(int v, int &d){
	parent[v] = d++;
	int d_ = parent[v];
	s.push_back(v);
	color[v] = 1;
	for (int w : g[v]){
		if (color[w] == 2) continue;
		if (color[w] == 0)
			t_dfs(w, d);
		parent[v] = min(parent[v], parent[w]);
	}
	if (parent[v] != d_) return;
	int id_ = sz++;
	while (true){
		int x = s.back();
		s.pop_back();
		color[x] = 2;
		id[x] = id_;
		ord.push_back(x);
		if (x == v) break;
	}
}

void tarjan(int n){
	memset(color, 0, sizeof color);
	memset(parent, 0, sizeof parent);
	memset(ans, 0, sizeof ans);
	s.resize(0);
	sz = 0;
	int d = 1;
	for (int i = 0; i < n; i++)
		if (color[i] == 0) t_dfs(i, d);
}

int main(){ _
	cin >> n >> m;
	pii e[110];
	for (int i = 0; i < m; i++){
		cin >> e[i].u >> e[i].v;
		if (e[i].u > e[i].v) swap(e[i].u, e[i].v);
	}
	for (int i = 0; i < m; i++){
		for (int j = i+1; j < m; j++){
			pii l = min(e[i], e[j]);
			pii r = max(e[i], e[j]);
			//cout << l.u << " " << l.v << "vs";
			//cout << r.u << " " << r.v << endl;
			if ((l.u < r.u) && (r.u < l.v) && (l.v < r.v)){
				//cout << "TRUE" << endl
				g[i].push_back(j+m);
				g[i+m].push_back(j);
				g[j].push_back(i+m);
				g[j+m].push_back(i);
			}
		}
	}
	tarjan(2*m);
	for (int i = 0; i < m; i++){
		if (id[i] == id[i+m]){
			cout << "Impossible" << endl;
			return 0;
		}
	}
	memset(ans, 0, sizeof ans);
	for (int i = ord.size()-1; i >= 0; i--){
		int var = ord[i];
		if (var >= m){
			if (ans[var-m]) continue;
			ans[var] = true;
		}
		else{
			if (ans[var+m]) continue;
			ans[var] = true;
		}
	}
	for (int i = 0; i < m; i++){
		if (ans[i]) cout << 'i';
		else cout << 'o';
	}
	cout << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 202;

int n, m;
int a[maxn], b[maxn], comp[maxn], ans[maxn];

vector<int> g[maxn];
vector<int> rg[maxn], topo, vec;

bool mark[maxn];

void dfs(int v, vector<int> *g, vector<int> &nodes) {
	mark[v] = true;
	for(int u : g[v]) {
		if(!mark[u])
			dfs(u, g, nodes);
	}
	nodes.push_back(v);
}

int main() {
	for(int i = 0; i < maxn; i++)
		ans[i] = -1;

	cin >> n >> m;

	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		if(a[i] > b[i])
			swap(a[i], b[i]);
	}

	for(int i = 0; i < m; i++) {
		for(int j = 0; j < i; j++) {
			int x1 = a[i], y1 = b[i];
			int x2 = a[j], y2 = b[j];
			if(((x2 <= y1 && x2 >= x1) && (!(x1 <= y1 && x1 >= x2))) || ((!(x2 <= y1 && x2 >= x1)) && (x1 <= y1 && x1 >= x2))) {
				int ii = i * 2;
				int jj = j * 2;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
				ii++;jj++;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
			}
		}
	}
//	cout << "G : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : g[i])
//			cout << j << ", ";
//		cout << endl;
//	}
//	cout << "RG : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : rg[i])
//			cout << j << ", ";
//		cout << endl;
//	}
	for(int i = 0; i < 2 * m; i++) {
		if(!mark[i])
			dfs(i, g, topo);
	}

	memset(mark, 0, sizeof mark);

	while(topo.size()) {
		int v = topo[topo.size() - 1];
		topo.pop_back();
		if(mark[v])
			continue;

		vec.clear();
		dfs(v, rg, vec);

		for(int u : vec) {
			comp[u] = v;
			if(comp[u] == comp[u ^ 1])
				return cout << "Impossble", 0;
			if(ans[u / 2] == -1)
				ans[u / 2] = 1 - (u % 2);
		}
	}
	for(int i= 0 ; i < m; i++) {
		if(ans[i])
			cout << 'o';
		else
			cout << 'i';
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 202;

int n, m;
int a[maxn], b[maxn], comp[maxn], ans[maxn];

vector<int> g[maxn];
vector<int> rg[maxn], topo, vec;

bool mark[maxn];

void dfs(int v, vector<int> *g, vector<int> &nodes) {
	mark[v] = true;
	for(int u : g[v]) {
		if(!mark[u])
			dfs(u, g, nodes);
	}
	nodes.push_back(v);
}

int main() {
	for(int i = 0; i < maxn; i++)
		ans[i] = -1;

	cin >> n >> m;

	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		if(a[i] > b[i])
			swap(a[i], b[i]);
	}

	for(int i = 0; i < m; i++) {
		for(int j = 0; j < i; j++) {
			int x1 = a[i], y1 = b[i];
			int x2 = a[j], y2 = b[j];
			if(x1 == x2 || x1 == y2 || y1 == x2 || y1 == y2)
				continue;
			if(((x1 < x2 || x1 > y2) ^ (y1 < x2 || y1 > y2))) {
				int ii = i * 2;
				int jj = j * 2;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
				ii++;jj++;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
			}
		}
	}
//	cout << "G : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : g[i])
//			cout << j << ", ";
//		cout << endl;
//	}
//	cout << "RG : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : rg[i])
//			cout << j << ", ";
//		cout << endl;
//	}
	for(int i = 0; i < 2 * m; i++) {
		if(!mark[i])
			dfs(i, g, topo);
	}

	memset(mark, 0, sizeof mark);

	while(topo.size()) {
		int v = topo[topo.size() - 1];
		topo.pop_back();
		if(mark[v])
			continue;

		vec.clear();
		dfs(v, rg, vec);

		for(int u : vec) {
			comp[u] = v;
			if(comp[u] == comp[u ^ 1])
				return cout << "Impossble", 0;
			if(ans[u / 2] == -1)
				ans[u / 2] = 1 - (u % 2);
		}
	}
	for(int i= 0 ; i < m; i++) {
		if(ans[i])
			cout << 'o';
		else
			cout << 'i';
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 202;

int n, m;
int a[maxn], b[maxn], comp[maxn], ans[maxn];

vector<int> g[maxn];
vector<int> rg[maxn], topo, vec;

bool mark[maxn];

void dfs(int v, vector<int> *g, vector<int> &nodes) {
	mark[v] = true;
	for(int u : g[v]) {
		if(!mark[u])
			dfs(u, g, nodes);
	}
	nodes.push_back(v);
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	for(int i = 0; i < maxn; i++)
		ans[i] = -1;

	cin >> n >> m;

	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		if(a[i] > b[i])
			swap(a[i], b[i]);
	}

	for(int i = 0; i < m; i++) {
		for(int j = 0; j < i; j++) {
			int x1 = a[i], y1 = b[i];
			int x2 = a[j], y2 = b[j];
			if(x1 == x2 || x1 == y2 || y1 == x2 || y1 == y2)
				continue;
			if(((x1 < x2 || x1 > y2) ^ (y1 < x2 || y1 > y2))) {
				int ii = i * 2;
				int jj = j * 2;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
				ii++;jj++;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
			}
		}
	}
//	cout << "G : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : g[i])
//			cout << j << ", ";
//		cout << endl;
//	}
//	cout << "RG : \n";
//	for(int i = 0; i < 2 * m; i++) {
//		cout << i << " : ";
//		for(int j : rg[i])
//			cout << j << ", ";
//		cout << endl;
//	}
	for(int i = 0; i < 2 * m; i++) {
		if(!mark[i])
			dfs(i, g, topo);
	}

	memset(mark, 0, sizeof mark);

	while(topo.size()) {
		int v = topo[topo.size() - 1];
		topo.pop_back();
		if(mark[v])
			continue;

		vec.clear();
		dfs(v, rg, vec);

		for(int u : vec) {
			comp[u] = v;
			if(comp[u] == comp[u ^ 1])
				return cout << "Impossible", 0;
			if(ans[u / 2] == -1)
				ans[u / 2] = 1 - (u % 2);
		}
	}
	for(int i= 0 ; i < m; i++) {
		if(ans[i])
			cout << 'o';
		else
			cout << 'i';
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 202;
int n, m;
int a[maxn], b[maxn], comp[maxn], ans[maxn];
vector<int> g[maxn];
vector<int> rg[maxn], topo, vec;
bool mark[maxn];
void dfs(int v, vector<int> *g, vector<int> &nodes) {
	mark[v] = true;
	for(int u : g[v]) {
		if(!mark[u])
			dfs(u, g, nodes);
	}
	nodes.push_back(v);
}

int main() {
	for(int i = 0; i < maxn; i++)
		ans[i] = -1;
	cin >> n >> m;
	for(int i = 0; i < m; i++) {
		int x, y;
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
		if(a[i] > b[i])
			swap(a[i], b[i]);
	}
	for(int i = 0; i < m; i++) {
		for(int j = 0; j < i; j++) {
			int x1 = a[i], y1 = b[i];
			int x2 = a[j], y2 = b[j];
			if(((x2 <= y1 && x2 >= x1) && (!(x1 <= y1 && x1 >= x2))) || ((!(x2 <= y1 && x2 >= x1)) && (x1 <= y1 && x1 >= x2))) {
				int ii = i * 2;
				int jj = j * 2;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
				ii++;jj++;
				g[ii ^ 1].push_back(jj);
				g[jj ^ 1].push_back(ii);
				rg[ii].push_back(jj ^ 1);
				rg[jj].push_back(ii ^ 1);
			}
		}
	}
	for(int i = 0; i < 2 * m; i++) {
		if(!mark[i])
			dfs(i, g, topo);
	}
	reverse(topo.begin(), topo.end());
	memset(mark, 0, sizeof mark);
	while(topo.size()) {
		int v = topo.back();
		topo.pop_back();
		if(mark[v])
			continue;

		vec.clear();
		dfs(v, rg, vec);
		for(int u : vec) {
			comp[u] = v;
			if(comp[u] == comp[u ^ 1])
				return cout << "Impossble", 0;
			if(ans[u / 2] == -1)
				ans[u / 2] = 1 - (u % 2);
		}
	}
	for(int i= 0 ; i < m; i++) {
		if(ans[i])
			cout << 'o';
		else
			cout << 'i';
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define mn 100005
#define inf 4444444444444444444
#define mod (ll) 1000000007
#define base 31
#define fi first
#define se second
#define pii pair <int, int>
#define pb push_back
#define mp make_pair

//int t, ntest;
int n, m, passed[mn], col[mn], kt=1;
pii p[mn];
vector <int> dsk[mn];

void input(){
	cin>>n>>m;
	for (int i=1; i<=m; i++) {
		cin>>p[i].fi>>p[i].se;
		if (p[i].fi>p[i].se) swap(p[i].fi, p[i].se);
	}
}

void dfs (int u){
	passed[u]=1;
	for (int i=0; i<dsk[u].size(); i++){
		int v=dsk[u][i];
		if (passed[v] && col[v]!=col[u]) continue;
		if (passed[v] && col[v]==col[u]) {
			kt=0;
			continue;
		}
		col[v]=3-col[u];
		dfs(v);
	}
}

void solve(){
	for (int i=1; i<m; i++){
		for (int j=i+1; j<=m; j++){
			if ((p[i].fi>p[j].fi && p[i].fi<p[j].se && p[i].se>p[j].se) || (p[j].fi>p[i].fi && p[j].fi<p[i].se && p[j].se>p[i].se)){
				dsk[i].pb(j);
				dsk[j].pb(i);
			}
		}
	}
	for (int i=1; i<=m; i++) if (passed[i]==0) {
		col[i]=1;
		dfs(i);
	}
	if (kt==0){
		cout<<"Impossible";
		return;
	}
	for (int i=1; i<=m; i++){
		if (col[i]==1) cout<<"i";
		else cout<<"o";
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	freopen("test.inp", "r", stdin);
//	freopen("test.out", "w", stdout);
//	cin>>t;
//	for (ntest=1; ntest<=t; ntest++){
		input();
		solve();
//	}
}

//mtrang_149


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define mn 100005
#define inf 4444444444444444444
#define mod (ll) 1000000007
#define base 31
#define fi first
#define se second
#define pii pair <int, int>
#define pb push_back
#define mp make_pair

//int t, ntest;
int n, m, passed[mn], col[mn], kt=1;
pii p[mn];
vector <int> dsk[mn];

void input(){
	cin>>n>>m;
	for (int i=1; i<=m; i++) cin>>p[i].fi>>p[i].se;
}

void dfs (int u){
	passed[u]=1;
	for (int i=0; i<dsk[u].size(); i++){
		int v=dsk[u][i];
		if (passed[v] && col[v]!=col[u]) continue;
		if (passed[v] && col[v]==col[u]) kt=0;
		col[v]=3-col[u];
		dfs(v);
	}
}

void solve(){
	for (int i=1; i<m; i++){
		for (int j=i+1; j<=m; j++){
			if ((p[i].fi>p[j].fi && p[i].fi<p[j].se && p[i].se>p[j].se) || (p[j].fi>p[i].fi && p[j].fi<p[i].se && p[j].se>p[i].se)){
				dsk[i].pb(j);
				dsk[j].pb(i);
			}
		}
	}
	for (int i=1; i<=m; i++) if (passed[i]==0) {
		col[i]=1;
		dfs(i);
	}
	if (kt==0){
		cout<<"Impossible";
		return;
	}
	for (int i=1; i<=m; i++){
		if (col[i]==1) cout<<"i";
		else cout<<"o";
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	freopen("test.inp", "r", stdin);
//	freopen("test.out", "w", stdout);
//	cin>>t;
//	for (ntest=1; ntest<=t; ntest++){
		input();
		solve();
//	}
}

//mtrang_149


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define mn 100005
#define inf 4444444444444444444
#define mod (ll) 1000000007
#define base 31
#define fi first
#define se second
#define pii pair <int, int>
#define pb push_back
#define mp make_pair

//int t, ntest;
int n, m, passed[mn], col[mn], kt=1;
pii p[mn];
vector <int> dsk[mn];

void input(){
	cin>>n>>m;
	for (int i=1; i<=m; i++) cin>>p[i].fi>>p[i].se;
}

void dfs (int u){
	passed[u]=1;
	for (int i=0; i<dsk[u].size(); i++){
		int v=dsk[u][i];
		if (passed[v] && col[v]!=col[u]) continue;
		if (passed[v] && col[v]==col[u]) {
			kt=0;
			continue;
		}
		col[v]=3-col[u];
		dfs(v);
	}
}

void solve(){
	for (int i=1; i<m; i++){
		for (int j=i+1; j<=m; j++){
			if ((p[i].fi>p[j].fi && p[i].fi<p[j].se && p[i].se>p[j].se) || (p[j].fi>p[i].fi && p[j].fi<p[i].se && p[j].se>p[i].se)){
				dsk[i].pb(j);
				dsk[j].pb(i);
			}
		}
	}
	for (int i=1; i<=m; i++) if (passed[i]==0) {
		col[i]=1;
		dfs(i);
	}
	if (kt==0){
		cout<<"Impossible";
		return;
	}
	for (int i=1; i<=m; i++){
		if (col[i]==1) cout<<"i";
		else cout<<"o";
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
//	freopen("test.inp", "r", stdin);
//	freopen("test.out", "w", stdout);
//	cin>>t;
//	for (ntest=1; ntest<=t; ntest++){
		input();
		solve();
//	}
}

//mtrang_149


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t,lf=0;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	{
		rig.push_back(ri[i]);
		//cout<<lef[n-1-i]<<" ";
	}
	//cout<<endl;
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    if(i==0)
	    	curr-=a;
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr-(l-1)*a)-rig.begin()));
	  // cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	curr=lef[0],l=1;
	int sol2=1;
	if(curr>t)
		sol2=0;
	for(int i=n-1;i>0;i--)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    l++;
	    if(curr>t)break;
	    sol2=max(sol2,l+(int)(upper_bound(lef.begin(),lef.end(),t-curr-(l-1)*a+lef[0])-lef.begin())-1);
	   //cout<<curr<<" "<<sol2<<" "<<l<<" "<<(int)(upper_bound(lef.begin(),lef.end(),t-curr-(l)*a+lef[0]-1+a)-lef.begin())-1<<" "<<t-curr-(l-1)*a+lef[0]-1<<endl;
	}
	cout<<min(max(sol,sol2),n)<<endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t,lf=0;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	{
		rig.push_back(ri[i]);
		//cout<<rig[n-1-i]<<" ";
	}
	//cout<<endl;
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    if(i==0)
	    	curr-=a;
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr-(l-1)*a)-rig.begin()));
	  // cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	cout<<min(sol,n)<<endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	rig.push_back(ri[i]);
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    if(i==0)
	    	curr-=a;
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr)-rig.begin()));
	   //cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	cout<<min(sol,n)<<endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	rig.push_back(ri[i]);
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr)-rig.begin()));
	  //  cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	cout<<min(sol,n)<<endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t,lf=0;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	{
		rig.push_back(ri[i]);
		//cout<<lef[n-1-i]<<" ";
	}
	//cout<<endl;
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    if(i==0)
	    	curr-=a;
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr-(l-1)*a)-rig.begin()));
	  // cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	curr=lef[0],l=1;
	int sol2=1;
	if(curr>t)
		sol2=0;
	for(int i=n-1;i>0;i--)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    l++;
	    if(curr>t)break;
	    sol2=max(sol2,l+(int)(upper_bound(lef.begin(),lef.end(),t-curr-(l)*a+lef[0]-1+a)-lef.begin())-1);
	   //cout<<curr<<" "<<sol2<<" "<<l<<" "<<(int)(upper_bound(lef.begin(),lef.end(),t-curr-(l)*a+lef[0]-1+a)-lef.begin())-1<<" "<<t-curr-(l)*a+lef[0]<<endl;
	}
	cout<<min(max(sol,sol2),n)<<endl;
}


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
vector<int> lef,rig;
int ri[700000];
int main()
{
	int n,a,b,t,lf=0;
	cin>>n>>a>>b>>t;
	string in;
	cin>>in;
	int x=0,y=n-1;
	int total=0;
	if(in[0]=='h')
	lef.push_back(1);
    else
    lef.push_back(b+1);

	for(int i=1;i<n;i++)
		if(in[i]=='h')
		{
			lef.push_back(lef[i-1]+a+1);
		}
		else
		{
			lef.push_back(lef[i-1]+a+b+1);
		}

	if(in[n-1]=='h')
	ri[n-1]=a+1;
    else
    ri[n-1]=b+a+1;

	for(int i=n-2;i>=0;i--)
		if(in[i]=='h')
		{
			ri[i]=ri[i+1]+1+a;
		}
		else
		{
			ri[i]=ri[i+1]+a+b+1;
		}
	for
	(int i=n-1;i>=0;i--)
	{
		rig.push_back(ri[i]);
		//cout<<rig[n-1-i]<<" ";
	}
	//cout<<endl;
	int curr=0,sol=0,l=0;
	sol=0;
	for(int i=0;i<n;i++)
	{
	    if(in[i]=='h')
	    {
	    	curr+=a+1;
	    }
	    else
	    {
	    	curr+=b+a+1;
	    }
	    if(i==0)
	    	curr-=a;
	    l++;
	    if(curr>t)break;
	    sol=max(sol,l+(int)(upper_bound(rig.begin(),rig.end(),t-curr-l*a)-rig.begin()));
	   //cout<<curr<<" "<<sol<<" "<<l<<endl;
	}
	cout<<min(sol,n)<<endl;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e6 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  int tmp = 0;
  for(int i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e5 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  // for(int i = n - 1; i >= 0; i--){
  //   cout << suf[i] << " ";
  // }

  int tmp = 0;
  for(int i = 0; i < n - 1; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e5 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  // for(int i = n - 1; i >= 0; i--){
  //   cout << suf[i] << " ";
  // }

  int tmp = 0;
  for(int i = 0; i < n - 2; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e5 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  // for(int i = n - 1; i >= 0; i--){
  //   cout << suf[i] << " ";
  // }

  int tmp = 0;
  for(int i = 0; i < n - 2; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    int cnt = 0;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
      cnt ++;
      if(cnt >= 100) break;
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;

const ll N = 4e6 + 5;
string s;
ll n, a, b, T;
ll pre[N];
ll suf[N];
ll ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(ll i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(ll i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  ll tmp = 0;
  for(ll i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    ll lo = i + 1, hi = n - 1;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;

const ll N = 4e6 + 5;
string s;
ll n, a, b, T;
ll pre[N];
ll suf[N];
ll ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(ll i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(ll i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  ll tmp = 0;
  for(ll i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    ll lo = i + 1, hi = n - 1;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  int ind;
  for(ll i = 0; i < n; i++){
    tmp = T;
    ind = i;
    if(i != 0) ind = n - i;
    if(i != 0) tmp -= suf[ind] + (i) * a - pre[0];
    if(tmp <= 0 ) continue;

    ll lo = 1, hi = ind - 1;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(pre[mid] <= tmp){
        lo = mid + 1;
      }
      else{
        hi = mid - 1;
      }
    }
    ans = max(ans, i + hi + 1);

  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;

const ll N = 4e6 + 5;
string s;
ll n, a, b, T;
ll pre[N];
ll suf[N];
ll ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(ll i = 0; i < n; i++){
    if(s[i] == 'w') pre[i] = b + 1;
    else pre[i] = 1;
    if(i) pre[i] += a;
    if(i) pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    if(s[i] == 'w') suf[i] = a + b + 1;
    else suf[i] = a + 1;
    suf[i]  += suf[i + 1];
  }

  for(ll i = 0; i < n; i++){
    ll lo = i + 1, hi = n - 1;
    if(pre[i] > T) break;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] + i * a + pre[i] <= T) hi = mid - 1;
      else lo = mid + 1;
    }
    ans = max(ans, i + 1 + n - lo);
  }

  // for(ll i = 1 ,j = n - 1; i <= j; i++, j--){
  //   swap(s[i] , s[j]);
  // }
  //
  //
  // for(ll i = 0; i < n; i++){
  //   if(s[i] == 'w') pre[i] = b + 1;
  //   else pre[i] = 1;
  //   if(i) pre[i] += a;
  //   if(i) pre[i] += pre[i - 1];
  // }
  //
  // for(ll i = n - 1; i >= 0; i--){
  //   if(s[i] == 'w') suf[i] = a + b + 1;
  //   else suf[i] = a + 1;
  //   suf[i]  += suf[i + 1];
  // }
  //
  // for(ll i = 0; i < n; i++){
  //   ll lo = i + 1, hi = n - 1;
  //   if(pre[i] > T) break;
  //   while(lo <= hi){
  //     ll mid = (lo + hi) >> 1;
  //     if(suf[mid] + i * a + pre[i] <= T) hi = mid - 1;
  //     else lo = mid + 1;
  //   }
  //   ans = max(ans, i + 1 + n - lo);
  // }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;

const ll N = 4e6 + 5;
string s;
ll n, a, b, T;
ll pre[N];
ll suf[N];
ll ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(ll i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(ll i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  ll tmp = 0;
  for(ll i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    ll lo = i + 1, hi = n - 1;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  int ind;
  for(ll i = 0; i < n; i++){
    tmp = T;
    ind = i;
    if(i != 0) ind = n - i;
    if(i != 0)
    tmp -= suf[ind] + (i) * a;
    else
    tmp -= pre[ind] + (i) * a;
    if(tmp <= 0 ) continue;
    ll lo = 1, hi = n - i - 1;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(pre[mid] - pre[0] + a <= tmp){
        lo = mid + 1;
      }
      else{
        hi = mid - 1;
      }
    }
    ans = max(ans, i + 1 + (hi));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e6 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  int tmp = 0;
  for(int i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e6 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  // for(int i = n - 1; i >= 0; i--){
  //   cout << suf[i] << " ";
  // }

  int tmp = 0;
  for(int i = 0; i < n - 2; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

const int N = 4e5 + 5;
string s;
int n, a, b, T;
int pre[N];
int suf[N];
int ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(int i = 0; i < n; i++){
    if(i != 0) pre[i] += a;
    if(s[i] == 'w'){
      pre[i] += b;
    }
    pre[i] += 1;
    if(i != 0)
    pre[i] += pre[i - 1];
  }

  for(int i = n - 1; i >= 0; i--){
    suf[i] += a;
    if(s[i] == 'w'){
      suf[i] += b;
    }
    suf[i] += 1;
    if(i != n - 1) suf[i] += suf[i + 1];
    else suf[i] += pre[0];
  }

  for(int i = 0; i < n; i++){
    if(pre[i] <= T){
      ans = max(ans, i + 1);
    }
  }

  // for(int i = n - 1; i >= 0; i--){
  //   cout << suf[i] << " ";
  // }

  int tmp = 0;
  for(int i = 0; i < n; i++){
    tmp = T;
    tmp -= pre[i] + (i) * a;
    if(tmp <= 0 ) continue;
    int lo = i + 1, hi = n - 1;
    while(lo <= hi){
      int mid = (lo + hi) >> 1;
      if(suf[mid] <= tmp){
        hi = mid - 1;
      }
      else{
        lo = mid + 1;
      }
    }
    ans = max(ans, i + 1 + (n - lo));
  }
  cout << ans << endl;
  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll, ll> ii;
typedef pair<ll, ll> pll;

const ll N = 4e6 + 5;
string s;
ll n, a, b, T;
ll pre[N];
ll suf[N];
ll ans = 0;

int main(){
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> n >> a >> b >> T;
  cin >> s;
  for(ll i = 0; i < n; i++){
    if(s[i] == 'w') pre[i] = b + 1;
    else pre[i] = 1;
    if(i) pre[i] += a;
    if(i) pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    if(s[i] == 'w') suf[i] = a + b + 1;
    else suf[i] = a + 1;
    suf[i]  += suf[i + 1];
  }

  for(ll i = 0; i < n; i++){
    ll lo = i + 1, hi = n - 1;
    if(pre[i] > T) break;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] + i * a + pre[i] <= T) hi = mid - 1;
      else lo = mid + 1;
    }
    ans = max(ans, i + 1 + n - lo);
  }

  for(ll i = 1 ,j = n - 1; i <= j; i++, j--){
    swap(s[i] , s[j]);
  }

  for(ll i = 0; i < n; i++){
    if(s[i] == 'w') pre[i] = b + 1;
    else pre[i] = 1;
    if(i) pre[i] += a;
    if(i) pre[i] += pre[i - 1];
  }

  for(ll i = n - 1; i >= 0; i--){
    if(s[i] == 'w') suf[i] = a + b + 1;
    else suf[i] = a + 1;
    suf[i]  += suf[i + 1];
  }

  for(ll i = 0; i < n; i++){
    ll lo = i + 1, hi = n - 1;
    if(pre[i] > T) break;
    while(lo <= hi){
      ll mid = (lo + hi) >> 1;
      if(suf[mid] + i * a + pre[i] <= T) hi = mid - 1;
      else lo = mid + 1;
    }
    ans = max(ans, i + 1 + n - lo);
  }
  cout << ans << endl;
  return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = R[rightDis]+L[mid]+min(rightDis,n-mid)*a;
        // int leftDis = n - mid;
        // expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense <= T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] <= T) {
            int indx = find(i + 1, n - 1, i);
            ans = max(ans, n - indx + i + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T) continue;
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r + 1) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - 1 - mid + 1;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T) continue;
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return l;
    while (l <= r) {
        int mid = (l + r) >> 1;
        LL expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += (LL)a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense <= T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        if (i == n - 1) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        if (R[i] > T) break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    int a = l, b = r;
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r + 1) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - 1 - mid + 1;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    if (l >= a && l <= b) {
        return l;
    } else {
        return n;
    }
}

int main() {

    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        int Max1 = find(max(i + 1, n - i), n - 1, i);
        int Max2 = find(i + 1, n - 1 - i, i); // >=
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T) continue;
        ans = max(ans, n - min(Max1, Max2) + i + 1);
    }
    cout << ans << endl;
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <string>
#include <cstdio>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>

#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <fstream>

using namespace std;

#define FF first
#define SS second
#define MP make_pair
#define PB push_back
#define lson rt << 1, l, mid
#define rson rt << 1 | 1, mid + 1, r

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL, LL> PLL;
typedef unsigned long long ULL;

inline int read(){
    int x = 0; char ch = getchar(); bool positive = 1;
    for (; ch < '0' || ch > '9'; ch = getchar())    if (ch == '-')  positive = 0;
    for (; ch >= '0' && ch <= '9'; ch = getchar())    x = x * 10 + ch - '0';
    return positive ? x : -x;
}

inline char RC (){
    char c = getchar ();
    while (c == ' '||c == '\n')     c = getchar ();
    return c;
}

inline LL gcd(LL a, LL b) {return b?gcd(b, a%b):a;}

inline LL lcm(LL a, LL b, LL MOD) {return a/gcd(a,b) * b % MOD;}

inline LL Sub(LL x, LL y, LL mod){
    LL res = x - y;
    while(res < 0) res += mod;
    return res;
}

inline LL Add(LL x, LL y, LL mod){
    LL res = x + y;
    while(res >= mod)  res -= mod;
    return res;
}

inline LL POW_MOD(LL x, LL y, LL mod){
    LL ret = 1;
    while(y > 0){
        if(y & 1)  ret = ret * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return ret;
}

/****************************define***************************************/

const int N = 500005 + 100;
const int M = 400000 + 100;
const LL INF = 9e18;
const int inf = 0x7fffffff;
const LL MOD = 1000000007;
const double PI = acos(-1.0);
const double G = 9.8;
const double eps = 1e-3;

string circle;
int n, a, b, T;
int L[N], R[N];

int find(int l, int r, int rightDis) {
    if (l > r) return n;
    while (l <= r) {
        int mid = (l + r) >> 1;
        int expense = L[mid] + R[rightDis];
        int leftDis = n - mid;
        expense += a * min(leftDis, rightDis);
        if (expense > T) {
            l = mid + 1;
        } else if (expense < T) {
            r = mid - 1;
        } else {
            return mid;
        }
    }
    return l;
}

int main() {
    cin >> n >> a >> b >> T >> circle;
    for (int i = 0; i < circle.size(); ++ i) {
        if (i == 0) {
            R[i] = (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            R[i] = R[i - 1] + a + (circle[i] == 'h' ? 0 : b) + 1;
        }
    }
    for (int i = circle.size() - 1; i >= 0; -- i) {
        int pre = (i + 1 - n) % n;
        if (pre == 0) {
            L[i] = a + (circle[i] == 'h' ? 0 : b) + 1;
        } else {
            L[i] = L[i + 1] + (circle[i] == 'h' ? 0 : b) + a + 1;
        }
    }
    // for (int i = 0; i < n; ++ i) {
    //     cout << R[i] << " ";
    // }
    // cout << endl;
    // for (int i = n - 1; i >= 0; -- i) {
    //     cout << L[i] << " ";
    // }
    // cout << endl;
    int ans = 0;
    for (int i = 0; i < n; ++ i) {
        // int indx = find(i + 1, n - 1, i);
        // cout << i << " " << Max1 << " " << Max2 << endl;
        if (R[i] > T)  break;
        int indx = find(i + 1, n - 1, i);
        ans = max(ans, n - indx + i + 1);

    }
    cout << ans << endl;
    return 0;
}