#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; #define rep(i, n) for(int i = 0; i < (n); i++) template using vi = vector; template using vii = vector>; template using viii = vector>; using P = pair; void chmin(ll & x, ll y) { x = min(x, y); } template struct FFT { const double pi = acos(-1); const int mx = 30; vector> zeta, invzeta; FFT() : zeta(mx), invzeta(mx) { int n = 1; for (int i = 0; i < mx; i++) { zeta[i] = polar(1.0, 2 * pi / n); n <<= 1; } n = 1; for (int i = 0; i < mx; i++) { invzeta[i] = polar(1.0, -2 * pi / n); n <<= 1; } } void dft(vector>& d, const int log, const int inv = false) { int n = (int)d.size(); if (n == 1 || log == 0) return; vector> d0, d1; for (int i = 0; i < n / 2; i++) { d0.push_back(d[2 * i]); d1.push_back(d[2 * i + 1]); } dft(d0, log - 1, inv); dft(d1, log - 1, inv); complex pow = 1, z = (inv ? invzeta[log] : zeta[log]); for (int i = 0; i < n / 2; i++) { d[i] = d0[i] + pow * d1[i]; pow *= z; } for (int i = n / 2; i < n; i++) { d[i] = d0[i - n / 2] + pow * d1[i - n / 2]; pow *= z; } return; } void idft(vector>& d, const int log) { dft(d, log, true); return; } vector convolution(vector& f, vector& g) { int n = 1, log = 0, lenf = (int)f.size(), leng = (int)g.size(); while (n < lenf + leng) { n <<= 1; log++; } vector> df(n), dg(n); for (int i = 0; i < lenf; i++) df[i] = f[i]; for (int i = 0; i < leng; i++) dg[i] = g[i]; dft(df, log); dft(dg, log); for (int i = 0; i < n; i++) df[i] *= dg[i]; idft(df, log); vector res(n); for (int i = 0; i < n; i++) res[i] = df[i].real() / n; return res; } }; int main() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); int n; cin >> n; vii check(n, vi(n)); rep(i, n) check[i][i] = true; int m; cin >> m; char s[70]; while (m--) { scanf("%s", s); vi d0, d1; rep(i, n) { if (s[i] == '0') d0.push_back(i); else d1.push_back(i); } for (int e0 : d0) for (int e1 : d1) { check[max(e0, e1)][min(e0, e1)] = true; //check[e1][e0] = true; } } bool ok = true; rep(i, n) rep(j, i) if (!check[i][j]) ok = false; cout << (ok ? "Yes" : "No") << endl; return 0; }