# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max() / 2;
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourd; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<LL>>g;
vector<edge>edges;
vector<Pll>v;
map<Pll, Pll>ma;
set<LL>st;
LL h, w, n, m, k, t, s, p, q, last, cnt, sum, ans, a[210000], b[210000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Seg {
	LL n;
	vector<LL>node, lazy;
	vector<bool> flag;
	Seg(LL n_) {
		n = 1; while (n < n_)n *= 2;
		node.resize(n * 2 - 1);
		flag.resize(n * 2 - 1);
		lazy.resize(n * 2 - 1);
		rep(i, n)node[n + i - 1] = 0;
		Rrep(i, n - 2)node[i] = min(node[i * 2 + 1], node[i * 2 + 2]);
		//区間最小などの時
		//rep(i, n * 2 - 1)lazy[i] = -1;
	}
	//区間の最小の遅延
	void ceval(LL k, LL l, LL r) {
		if (lazy[k] != 0) {
			node[k] = -node[k];
			flag[k] = !flag[k];
			if (r - l >= 1) {
				lazy[k * 2 + 1] ^= 1;
				lazy[k * 2 + 2] ^= 1;
			}
			lazy[k] = 0;
		}
	}
	void update1(LL l, LL r) {
		update1(0, 0, n - 1, l, r);
	}
	void update1(LL i, LL a, LL b, LL l, LL r) {
		ceval(i, a, b);
		if (b < l || r < a)return;
		if (l <= a && b <= r) {
			lazy[i] ^= 1;
			ceval(i, a, b);
		}
		else {
			update1(i * 2 + 1,  a, (a + b) / 2, l, r);
			update1(i * 2 + 2, (a + b + 1) / 2, b, l, r);
			node[i] = (node[i * 2 + 1] + node[i * 2 + 2]);
		}
	}
	void update2(LL x,LL l) {
		update2(0, x, 0, n - 1, l);
	}
	void update2(LL i, LL x, LL a, LL b, LL l) {
		ceval(i, a, b);
		if (b < l || l < a)return;
		if (l <= a && b <= l) {
			node[i] = x * (flag[i] ? -1 : 1);
		}
		else {
			update2(i * 2 + 1, x, a, (a + b) / 2, l);
			update2(i * 2 + 2, x, (a + b + 1) / 2, b, l);
			node[i] = (node[i * 2 + 1] + node[i * 2 + 2]);
		}
	}
	LL getsum(LL l, LL r) {
		return getsum(0, 0, n - 1, l, r);
	}
	LL getsum(LL i, LL a, LL b, LL l, LL r) {
		ceval(i, a, b);
		if (b < l || r < a)return 0;
		if (l <= a && b <= r)return node[i];
		return (getsum(i * 2 + 1, a, (a + b) / 2, l, r) + getsum(i * 2 + 2, (a + b + 1) / 2, b, l, r));
	}
};
Seg seg(210000);
int main() {
	cin >> n >> m >> q;
	rep(i,m){
		cin >> a[i];
		if (a[i] == 0)
			seg.update1(i, m), cnt++;
		else
			seg.update2(a[i], i);
	}
	rep(i, q) {
		LL x, y;
		cin >> x >> y;
		x--, y--;
		if (a[x]==a[y]) {}
		else if(a[x]==0){
			seg.update1(x,m);
			seg.update1(y,m);
			seg.update2(0, y);
			seg.update2(a[y], x);		
		}
		else if (a[y]==0) {
			swap(x, y);
			seg.update1(x, m);
			seg.update1(y, m);
			seg.update2(0, y);
			seg.update2(a[y], x);
		}
		else {
			seg.update2(a[x],y);
			seg.update2(a[y], x);
		}
		swap(a[x],a[y]);
		LL cur = (seg.getsum(0, m) % n + n) % n;
		cout << ((n-cur)%n+1)*(cnt%2?-1:1) << endl;
	}
	return 0;
}
