#include
#define IOS ios::sync_with_stdio(false);cin.tie(0);
#define x first
#define y second
#define all(x) x.begin(),x.end();
using namespace std;
typedef pair PII;
int n;
bool check(int x){
string s = to_string(x);
// cout< int pr = 0;
for(int i ...