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

namespace zadatak5
{
    internal class Program
    {
        struct Put
        {
            public int santa1;
            public int santa2;
            public int tip;
        }
        static void Main(string[] args)
        {
            int[] NiM = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            Put[] putevi = new Put[NiM[1]];
            for (int i = 0; i < NiM[1]; i++)
            {
                int[] jedanPut = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                putevi[i].santa1 = jedanPut[0];
                putevi[i].santa2 = jedanPut[1];
                putevi[i].tip = jedanPut[2];
            }
            int[] MikaiLaza = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        }
    }
}