#include <bits/stdc++.h>
#define	f first
#define	s second
#define int long long
using namespace	std;
const int INF=LLONG_MAX;
typedef pair<int,int> P;
signed main(){

  vector<int> match;
  P ad[100000];
  int n,t,q,wh[100000];
  cin>>n>>t>>q;
  for(int i=0,a,b;i<n&&cin>>a>>b;i++) ad[i]=P(a,b);
  for(int i=0;i<n-1;i++) if(ad[i].s==1&&ad[i+1].s==2) match.push_back((ad[i].f+ad[i+1].f)/2);
  for(int i=0;i<n;i++){
    if(ad[i].s==1){
      auto it=lower_bound(match.begin(),match.end(),ad[i].f);
      if(it==match.end()) wh[i]=INF;
      else wh[i]=*it;
    }
    else{
      auto it=upper_bound(match.begin(),match.end(),ad[i].f);
      if(it==match.end()) wh[i]=*match.rbegin();
      else if(it==match.begin()) wh[i]=-INF;
      else wh[i]=*(it-1);
    }
  }
  for(int i=0,a;i<q&&cin>>a;i++){
    a--;
    if(ad[a].s==1){
      if(ad[a].f+t<wh[a]) cout<<ad[a].f+t<<endl;
      else cout<<wh[a]<<endl;
    }
    else{
      if(ad[a].f-t>wh[a]) cout<<ad[a].f-t<<endl;
      else cout<<wh[a]<<endl;
    }
  }
  return 0;
}