#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int W,H; cin>>W>>H; vector> grid(W, vector(H)); for(int i=0;i>grid[i][j]; } } vector> g(H*W); auto id = [&] (int i, int j){ return i*W+j; }; for(int i=0;i+1 vis(H*W); bool found = false; for(int i=0;i stk; stk.emplace(i); while(!stk.empty()){ auto u = stk.top(); stk.pop(); E+=g[u].size(); for(auto& v: g[u]){ if(vis[v]) continue; vis[v]=true; V+=1; stk.emplace(v); } } E/=2; if(V<=E){ found=true; break; } } cout<<(found?"possible":"impossible")<