using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PetljaTakmicenje
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]), m = int.Parse(s[1]);
            bool[] t = new bool[400002];
            t[1] = true;
            List<int>[] a = new List<int>[m];  
            for (int i = 0; i < m; i++)
            {
                a[i] = new List<int>();
            }
            for (int i = 0; i < m; i++)
            {
                s = Console.ReadLine().Split();
                a[int.Parse(s[0]) - 1].Add(int.Parse(s[1]) - 1);
            }
        }
    }
}