There are n cities in Cyberland, numbered from 1 to n, connected by m bidirectional roads. The j-th road connects city aj and bj.

For tourists, souvenirs are sold in every city of Cyberland. In particular, city i sell it at a price of wi.

Now there are q queries for you to handle. There are two types of queries:

  * "C a w": The price in city a is changed to w.
  * "A a b": Now a tourist will travel from city a to b. He will choose a route, he also doesn't want to visit a city twice. He will buy souvenirs at the city where the souvenirs are the cheapest (possibly exactly at city a or b). You should output the minimum possible price that he can buy the souvenirs during his travel.



More formally, we can define routes as follow:

  * A route is a sequence of cities [x1, x2, ..., xk], where k is a certain positive integer.
  * For any 1 ≤ i < j ≤ k, xi ≠ xj.
  * For any 1 ≤ i < k, there is a road connecting xi and xi + 1.
  * The minimum price of the route is min(wx1, wx2, ..., wxk).
  * The required answer is the minimum value of the minimum prices of all valid routes from a to b.

Input

The first line of input contains three integers n, m, q (1 ≤ n, m, q ≤ 105), separated by a single space.

Next n lines contain integers wi (1 ≤ wi ≤ 109).

Next m lines contain pairs of space-separated integers aj and bj (1 ≤ aj, bj ≤ n, aj ≠ bj).

It is guaranteed that there is at most one road connecting the same pair of cities. There is always at least one valid route between any two cities.

Next q lines each describe a query. The format is "C a w" or "A a b" (1 ≤ a, b ≤ n, 1 ≤ w ≤ 109).

Output

For each query of type "A", output the corresponding answer.

Examples

Input

3 3 3
1
2
3
1 2
2 3
1 3
A 2 3
C 1 5
A 2 3


Output

1
2


Input

7 9 4
1
2
3
4
5
6
7
1 2
2 5
1 5
2 3
3 4
2 4
5 6
6 7
5 7
A 2 3
A 6 4
A 6 7
A 3 3


Output

2
1
5
3

Note

For the second sample, an optimal routes are:

From 2 to 3 it is [2, 3].

From 6 to 4 it is [6, 5, 1, 2, 4].

From 6 to 7 it is [6, 5, 7].

From 3 to 3 it is [3].

<image>
#include <bits/stdc++.h>
using namespace std;
struct edge {
  int to, fr;
};
int n, m, q;
int val[200005];
struct Edgelink {
  edge e[200005 << 1];
  int lst[200005], tote;
  void addedge(int a, int b) {
    e[++tote] = (edge){b, lst[a]};
    lst[a] = tote;
  }
  edge& operator[](int x) { return e[x]; }
} E, G;
int cnt, low[200005], dfn[200005], vis[200005];
int stk[200005], top, poi[200005];
int totid;
void tarjan(int v, int f) {
  low[v] = dfn[v] = ++cnt;
  vis[v] = 1;
  stk[++top] = v;
  for (int i = E.lst[v]; i; i = E[i].fr) {
    int u = E[i].to;
    if (u == f) continue;
    if (vis[u] == 1) low[v] = min(low[v], dfn[u]);
    if (vis[u] == 0) {
      tarjan(u, v);
      low[v] = min(low[v], low[u]);
      if (dfn[v] <= low[u]) {
        int k, len = 0;
        ++totid;
        do poi[++len] = k = stk[top--];
        while (k != u);
        poi[++len] = v;
        for (int j = 1; j <= len; j++) {
          G.addedge(poi[j], totid);
          G.addedge(totid, poi[j]);
        }
      }
    }
  }
  vis[v] = 2;
}
namespace RST {
multiset<int> S[200005];
int fa[200005], top[200005], dep[200005], son[200005], sz[200005];
int L[200005], ID[200005], Ti;
struct Seg {
  struct Tree {
    int L, R;
    int mn;
  } T[200005 << 2];
  void Up(int p) { T[p].mn = min(T[p << 1].mn, T[p << 1 | 1].mn); }
  void Build(int l, int r, int p) {
    T[p].L = l, T[p].R = r;
    if (l == r) {
      if (ID[l] > n)
        T[p].mn = *S[ID[l]].begin();
      else
        T[p].mn = val[ID[l]];
      return;
    }
    int mid = (l + r) >> 1;
    Build(l, mid, p << 1);
    Build(mid + 1, r, p << 1 | 1);
    Up(p);
  }
  int Query(int l, int r, int p) {
    if (T[p].L == l && T[p].R == r) return T[p].mn;
    int mid = (T[p].L + T[p].R) >> 1;
    if (mid >= r)
      return Query(l, r, p << 1);
    else if (mid < l)
      return Query(l, r, p << 1 | 1);
    else
      return min(Query(l, mid, p << 1), Query(mid + 1, r, p << 1 | 1));
  }
  void change(int x, int c, int p) {
    if (T[p].L == T[p].R) {
      T[p].mn = c;
      return;
    }
    int mid = (T[p].L + T[p].R) >> 1;
    if (mid >= x)
      change(x, c, p << 1);
    else
      change(x, c, p << 1 | 1);
    Up(p);
  }
} Tr;
void dfstree(int v, int f) {
  sz[v] = 1;
  fa[v] = f, dep[v] = dep[f] + 1;
  for (int i = G.lst[v]; i; i = G[i].fr) {
    int u = G[i].to;
    if (u == f) continue;
    if (v > n) S[v].insert(val[u]);
    dfstree(u, v);
    sz[v] += sz[u];
    if (sz[u] > sz[son[v]]) son[v] = u;
  }
}
void Redfs(int v, int tp) {
  top[v] = tp;
  L[v] = ++Ti;
  ID[Ti] = v;
  if (son[v]) Redfs(son[v], tp);
  for (int i = G.lst[v]; i; i = G[i].fr) {
    int u = G[i].to;
    if (u == fa[v] || u == son[v]) continue;
    Redfs(u, u);
  }
}
void Init() {
  dfstree(1, 0);
  Redfs(1, 1);
  Tr.Build(1, Ti, 1);
}
void update(int x, int w) {
  Tr.change(L[x], w, 1);
  int f = fa[x];
  if (f > n) {
    S[f].erase(S[f].find(val[x]));
    S[f].insert(w);
    Tr.change(L[f], *S[f].begin(), 1);
  }
  val[x] = w;
}
int Query(int x, int y) {
  int res = 2e9;
  while (top[x] != top[y]) {
    if (dep[top[x]] < dep[top[y]]) swap(x, y);
    res = min(res, Tr.Query(L[top[x]], L[x], 1));
    x = fa[top[x]];
  }
  if (dep[x] < dep[y]) swap(x, y);
  res = min(res, Tr.Query(L[y], L[x], 1));
  if (y > n) {
    int f = fa[y];
    if (f && f <= n) res = min(res, val[f]);
  }
  return res;
}
}  // namespace RST
void init() {
  totid = n;
  tarjan(1, 0);
  RST::Init();
}
int main() {
  scanf("%d%d%d", &n, &m, &q);
  for (int i = 1; i <= n; i++) scanf("%d", &val[i]);
  for (int i = 1, a, b; i <= m; i++) {
    scanf("%d%d", &a, &b);
    E.addedge(a, b);
    E.addedge(b, a);
  }
  init();
  char op[5];
  for (int x, y; q; q--) {
    scanf("%s%d%d", op, &x, &y);
    if (op[0] == 'A')
      printf("%d\n", RST::Query(x, y));
    else
      RST::update(x, y);
  }
  return 0;
}
