#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Cliquer {
  vector<ll> adj, f, g, h;
  int n, n_1, n_2;
  Cliquer(const vector<ll>& _adj) {
    adj = _adj;
    n = int(adj.size());
    assert(n > 0);
    for (int i = 0; i < n; i++) {
      adj[i] |= (1LL << i);
    }
    n_2 = n / 2;
    n_1 = n - n_2;
    f.assign((1LL << n_1), 0LL);
    g.assign((1LL << n_2), 0LL);
    for (ll x = 0; x < ll(f.size()); x++) {
      ll mask = (1LL << n) - 1;
      for (int i = 0; i < n_1; i++)
        if (x & (1LL << i)) {
          mask &= adj[i];
        }
      f[x] = ((mask & x) == x);
    }
    for (ll x = 0; x < ll(g.size()); x++) {
      ll mask = (1LL << n) - 1;
      ll y = (x << n_1);
      for (int i = n_1; i < n; i++)
        if (y & (1LL << i)) {
          mask &= adj[i];
        }
      g[x] = ((mask & y) == y);
    }
  }
  ll calc(ll x) {
    if (x == 0) return 0;
    ll& ans = h[x];
    if (ans != -1) return ans;
    ans = g[x] * __builtin_popcount(x);
    for (int i = 0; i < n_2; i++)
      if (x & (1 << i)) {
        ans = max(ans, calc(x ^ (1 << i)));
      }
    return ans;
  }
  int max_clique_size() {
    h.assign((1 << n_2), -1LL);
    int ans = 0;
    for (ll x = 0; x < ll(f.size()); x++)
      if (f[x]) {
        ll mask = (1LL << n) - 1;
        int res = 0;
        for (int i = 0; i < n_1; i++)
          if (x & (1 << i)) {
            res++;
            mask &= adj[i];
          }
        res += calc(mask >> n_1);
        ans = max(ans, res);
      }
    return ans;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<ll> adj(m, (1LL << m) - 1);
  map<string, int> id;
  int cur = 0;
  set<int> s;
  auto process = [&]() {
    assert(int(s.size()) <= m);
    for (int x : s)
      for (int y : s)
        if (x != y) {
          adj[x] &= (~(1LL << y));
        }
  };
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      process();
      s.clear();
    } else {
      string f;
      cin >> f;
      if (id.find(f) == id.end()) id[f] = cur++;
      s.insert(id[f]);
    }
  }
  process();
  assert(cur == m);
  Cliquer c(adj);
  cout << c.max_clique_size() << '\n';
}

### Prompt

Please create a solution in Cpp to the following problem:

Hiasat registered a new account in NeckoForces and when his friends found out about that, each one of them asked to use his name as Hiasat's handle.

Luckily for Hiasat, he can change his handle in some points in time. Also he knows the exact moments friends will visit his profile page. Formally, you are given a sequence of events of two types:

  * 1 — Hiasat can change his handle. 
  * 2 s — friend s visits Hiasat's profile. 



The friend s will be happy, if each time he visits Hiasat's profile his handle would be s.

Hiasat asks you to help him, find the maximum possible number of happy friends he can get.

Input

The first line contains two integers n and m (1 ≤ n ≤ 10^5, 1 ≤ m ≤ 40) — the number of events and the number of friends.

Then n lines follow, each denoting an event of one of two types: 

  * 1 — Hiasat can change his handle. 
  * 2 s — friend s (1 ≤ |s| ≤ 40) visits Hiasat's profile. 



It's guaranteed, that each friend's name consists only of lowercase Latin letters.

It's guaranteed, that the first event is always of the first type and each friend will visit Hiasat's profile at least once.

Output

Print a single integer — the maximum number of happy friends.

Examples

Input


5 3
1
2 motarack
2 mike
1
2 light


Output


2


Input


4 3
1
2 alice
2 bob
2 tanyaromanova


Output


1

Note

In the first example, the best way is to change the handle to the "motarack" in the first event and to the "light" in the fourth event. This way, "motarack" and "light" will be happy, but "mike" will not.

In the second example, you can choose either "alice", "bob" or "tanyaromanova" and only that friend will be happy.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Cliquer {
  vector<ll> adj, f, g, h;
  int n, n_1, n_2;
  Cliquer(const vector<ll>& _adj) {
    adj = _adj;
    n = int(adj.size());
    assert(n > 0);
    for (int i = 0; i < n; i++) {
      adj[i] |= (1LL << i);
    }
    n_2 = n / 2;
    n_1 = n - n_2;
    f.assign((1LL << n_1), 0LL);
    g.assign((1LL << n_2), 0LL);
    for (ll x = 0; x < ll(f.size()); x++) {
      ll mask = (1LL << n) - 1;
      for (int i = 0; i < n_1; i++)
        if (x & (1LL << i)) {
          mask &= adj[i];
        }
      f[x] = ((mask & x) == x);
    }
    for (ll x = 0; x < ll(g.size()); x++) {
      ll mask = (1LL << n) - 1;
      ll y = (x << n_1);
      for (int i = n_1; i < n; i++)
        if (y & (1LL << i)) {
          mask &= adj[i];
        }
      g[x] = ((mask & y) == y);
    }
  }
  ll calc(ll x) {
    if (x == 0) return 0;
    ll& ans = h[x];
    if (ans != -1) return ans;
    ans = g[x] * __builtin_popcount(x);
    for (int i = 0; i < n_2; i++)
      if (x & (1 << i)) {
        ans = max(ans, calc(x ^ (1 << i)));
      }
    return ans;
  }
  int max_clique_size() {
    h.assign((1 << n_2), -1LL);
    int ans = 0;
    for (ll x = 0; x < ll(f.size()); x++)
      if (f[x]) {
        ll mask = (1LL << n) - 1;
        int res = 0;
        for (int i = 0; i < n_1; i++)
          if (x & (1 << i)) {
            res++;
            mask &= adj[i];
          }
        res += calc(mask >> n_1);
        ans = max(ans, res);
      }
    return ans;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<ll> adj(m, (1LL << m) - 1);
  map<string, int> id;
  int cur = 0;
  set<int> s;
  auto process = [&]() {
    assert(int(s.size()) <= m);
    for (int x : s)
      for (int y : s)
        if (x != y) {
          adj[x] &= (~(1LL << y));
        }
  };
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t == 1) {
      process();
      s.clear();
    } else {
      string f;
      cin >> f;
      if (id.find(f) == id.end()) id[f] = cur++;
      s.insert(id[f]);
    }
  }
  process();
  assert(cur == m);
  Cliquer c(adj);
  cout << c.max_clique_size() << '\n';
}

```