Go: package main

import "fmt"

func main() {
	for i := 1; i < 10; i++ {
		for j := 1; j < 10; j++ {
			fmt.Printf("%dx%d=%d\n", i, j, i*j)
		}
	}
}

C++: #include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
using namespace std;
int main(){
	for(int i=1;i<10;i++){
		for(int l=1;l<10;l++){
			cout<<i<<'x'<<l<<"="<<i*l<<endl;
			
			
			
		}
		
		
		
	}
}

C++: #include <iostream>
using namespace std;

int main(void)
{
for (i=1;i<=9;i++)
{
for (j=1;j<=9;j++)
{
cout << i << "x" << j << "=" << i*j << endl;
}
}
return 0;
}

C++: #include <iostream>

int main() {
	for (int i = 0; i <= 9; i++)
		for (int j = 0; j <= 9; j++)
			std::cout << i << "x" << j << "=" << i * j << std::endl;
}

C++: #include<iostream>
using namespace std;
int main(){
  for(int x = 1; x < 10; x++)
    for(int y = 1; y < 10; y++)
      cout << x << "x" << y << "=" << x*y << '\n';

  return 0;
}

C++: int main(){
	int a,b;
	for(a=1;a<=9;a++){
		for(b=1;b<=9;b++)
		std::cout<< a << "x" << b << "=" << a*b <<std::endl;
	}
	return 0;
	}

C++: #include <stdio.h>
#include<iostream>
using namespace std;

int main(void){
	
	int ans,i,j;
	
	for(i=1;i<10;i++){
		for(j=1;j<10;j++){
			
			ans=i*j;
			
			cout<<i<<"x"<<j<<"="<<ans<<endl;
			
		}
}

C++: #include <stdio.h>

int main(void){
  int i, j, k;
  for(i = 1; i <= 9; i++){
    for(j = 1; j <= 9; j++){
      k = i * j;
      printf("%dx%d=%d\n", i, j, k);
	}
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define CLR(a) memset((a), 0 ,sizeof(a))
#define NCLR(a) memset((a), -1 ,sizeof(a))
#define dump(x) cout << #x << " = " << (x) << "\n";
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef priority_queue<int> maxpq;
typedef priority_queue< int, vector<int>, greater<int> > minpq;
typedef complex<double> P;
static const double EPS = 1e-10;
static const double PI = acos( -1.0 );
static const int mod = 1000000007;
static const int INF = 1 << 29;
static const LL LL_INF = 1152921504606846976;
static const int dx[] = { -1, 0, 1, 0, 1, -1, 1, -1 };
static const int dy[] = { 0, -1, 0, 1, 1, 1, -1, -1 };


int main() {
#ifdef _DEBUG
	printf( "debug\n" );
#endif
	for ( int i = 1; i < 10; i++ ) {
		for ( int j = 1; j < 10; j++ ) {
			printf( "%dxd%d=%d\n", i, j, i * j );
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int main()
{
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            cout<<i<<"×"<<j<<"="<<i*j<<endl;
        }
    }
    return 0;
}

C++: //============================================================================
// Name        : I.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include<stdio.h>
#include<vector>
#include<memory.h>
#define N 200
using namespace std;
vector<int> graph[N];
vector<int> tmp;
int sstack[N], pathstack[N], dfsn[N];
int ptop, cnt, stop;
int mark[N], cntt[N];
int color;
int i, n, ans, res, m, u, v, j;
void init() {
	memset(dfsn, -1, sizeof(dfsn));
	memset(mark, -1, sizeof(mark));
	ptop = cnt = stop = color = 0;
}
void Gabow(int w) {
	int v, i;
	dfsn[w] = cnt++;
	sstack[stop++] = pathstack[ptop++] = w;
	for (i = 0; i < graph[w].size(); ++i) {
		v = graph[w][i];
		if (dfsn[v] == -1)
			Gabow(v);
		else if (mark[v] == -1)
			while (dfsn[pathstack[ptop - 1]] > dfsn[v])
				ptop--;
	}
	if (pathstack[ptop - 1] == w)
		ptop--;
	else
		return;
	do {
		mark[v = sstack[--stop]] = color;
	} while (v != w);
	color++;
}

int main() {
	while (scanf("%d%d", &n, &m) != EOF) {
		ans = 10001;
		for (i = 0; i < n; i++)
			graph[i].clear();
		while (m--) {
			scanf("%d%d", &u, &v);
			graph[u].push_back(v);
		}
		for (i = 0; i < n; i++) {
			memset(cntt, 0, sizeof(cntt));
			tmp = graph[i];
			graph[i].clear();
			init();
			Gabow((i + 1) % n);
			res = 0;
			for (i = 0; i < n; i++) {
				if (mark[i] >= 0)
					cntt[mark[i]]++;
				res = max(res, cntt[mark[i]]);
			}
			if (res < ans)
				ans = res;
			graph[i] = tmp;
		/*	for (i = 0; i < n; i++)
				printf("%d ", mark[i]);
			printf("\n");*/
		}
		if (ans != 1)
			printf("%d\n", ans);
		else
			printf("0\n");
	}

	return 0;
}
/*
 5 4
 1 2
 2 1
 3 4
 4 3
 */