Language: C++

#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
vvi E(100010);
ll par[100010];
map<pair<ll,ll>,ll>dist;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n,m;cin>>n>>m;
  vi hoge(n+10);
  for(int i=0;i<n+m-1;i++){
    ll a,b;cin>>a>>b;
    E[a].pb(b);
    hoge[b]++;
  }
  for(int i=1;i<=n;i++){
    if(hoge[i]>0)continue;
    queue<ll>que;
    que.push(i);
    while(!que.empty()){
      ll now=que.front();
      que.pop();
      for(int j=0;j<E[now.F].size();j++){
	if(par[E[now.F][j]]>0){
	  par[E[now.F][j]]=now.F;
	  que.push(E[now.F][j]);
	}else if(par[E[now.F][j]]==0){
	  par[E[now.F][j]]=now.F;
	  que.push(E[now.F][j]);
	}
      }
    }
  }
  for(int i=1;i<=n;i++){
    cout<<par[i]<<endl;
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:45:27: note: in expansion of macro 'F'
   45 |       for(int j=0;j<E[now.F].size();j++){
      |                           ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:46:22: note: in expansion of macro 'F'
   46 |         if(par[E[now.F][j]]>0){
      |                      ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:47:21: note: in expansion of macro 'F'
   47 |           par[E[now.F][j]]=now.F;
      |                     ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:47:32: note: in expansion of macro 'F'
   47 |           par[E[now.F][j]]=now.F;
      |                                ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:48:26: note: in expansion of macro 'F'
   48 |           que.push(E[now.F][j]);
      |                          ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:49:28: note: in expansion of macro 'F'
   49 |         }else if(par[E[now.F][j]]==0){
      |                            ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:50:21: note: in expansion of macro 'F'
   50 |           par[E[now.F][j]]=now.F;
      |                     ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:50:32: note: in expansion of macro 'F'
   50 |           par[E[now.F][j]]=now.F;
      |                                ^
a.cc:7:11: error: request for member 'first' in 'now', which is of non-class type 'long long int'
    7 | #define F first
      |           ^~~~~
a.cc:51:26: note: in expansion of macro 'F'
   51 |           que.push(E[now.F][j]);
      |                          ^