#include <bits/stdc++.h>   using namespace std;   const int INF = 1e9;   set<int> fang[400001];   map<int, int> cishu[400001];   int n, m, q, to1[400001], Nxt[400001], first1[400001], dfn[400001], low[400001];   int to[500001], nxt[500001], first[500001], cnt, e1, x2, fa[400001];   int sum, tot = 0, ss[400001], heavy[400001], siz[400001], seg[1000001];   int pos[400001], top[400001], deep[400001], h = 0, Stack[400001 * 10];   char ch;   void Build(int x, int y) {     to1[cnt] = y;     Nxt[cnt] = first1[x];     first1[x] = cnt++;   }   void insert(int x, int y) {     to[e1] = y;     nxt[e1] = first[x];     first[x] = e1++;   }   void tarjan(int x) {     dfn[x] = low[x] = ++tot;     Stack[++h] = x;     for (int i = first1[x]; i != -1; i = Nxt[i])       if (!dfn[to1[i]]) {         tarjan(to1[i]);         low[x] = min(low[x], low[to1[i]]);         if (dfn[x] <= low[to1[i]]) {           int z;           sum++;           do {             z = Stack[h--];             insert(sum, z);             insert(z, sum);           } while (z != to1[i]);           insert(sum, x);           insert(x, sum);         }       } else         low[x] = min(low[x], dfn[to1[i]]);   }   void dfs(int o, int p) {     siz[o] = 1;     deep[o] = deep[p] + 1;     fa[o] = p;     for (int i = first[o]; i != -1; i = nxt[i])       if (to[i] != p) {         dfs(to[i], o);         siz[o] += siz[to[i]];         if (siz[to[i]] > siz[heavy[o]]) heavy[o] = to[i];       }   }   void dfs1(int o, int p) {     pos[o] = ++x2;     if (heavy[o] > 0) {       top[heavy[o]] = top[o];       dfs1(heavy[o], o);       for (int i = first[o]; i != -1; i = nxt[i])         if ((to[i] != p) && (to[i] != heavy[o])) {           top[to[i]] = to[i];           dfs1(to[i], o);         }     }   }   void put(int o, int p, int q, int r, int s) {     if ((o == q) && (p == q)) {       seg[r] = s;       return;     }     int mid = (o + p) / 2;     if (q <= mid) {       put(o, mid, q, r * 2, s);       seg[r] = min(seg[r * 2 + 1], seg[r * 2]);     } else {       put(mid + 1, p, q, r * 2 + 1, s);       seg[r] = min(seg[r * 2], seg[r * 2 + 1]);     }   }   int get(int o, int p, int q, int r, int s) {     if ((o == q) && (p == r)) return seg[s];     int mid = (o + p) / 2;     if (r <= mid)       return get(o, mid, q, r, s * 2);     else if (q > mid)       return get(mid + 1, p, q, r, s * 2 + 1);     else       return min(get(o, mid, q, mid, s * 2),                  get(mid + 1, p, mid + 1, r, s * 2 + 1));   }   int gettree(int o, int p) {     int yu = INF;     while (top[o] != top[p]) {       if (deep[top[o]] < deep[top[p]]) {         int t = o;         o = p;         p = t;       }       yu = min(yu, get(1, sum, pos[top[o]], pos[o], 1));       o = fa[top[o]];     }     if (deep[o] > deep[p]) {       int t = o;       o = p;       p = t;     }     yu = min(yu, get(1, sum, pos[o], pos[p], 1));     if (o > n) yu = min(yu, ss[fa[o]]);     return yu;   }   int main() {     memset(first1, -1, sizeof(first1));     memset(first, -1, sizeof(first));     scanf( %d%d%d , &n, &m, &q);     sum = n;     for (int i = 1; i <= n; i++) scanf( %d , &ss[i]);     for (int i = 1; i <= m; i++) {       int x, y;       scanf( %d%d , &x, &y);       Build(x, y);       Build(y, x);     }     for (int i = 1; i <= n; i++)       if (!dfn[i]) tarjan(i);     deep[0] = 0;     dfs(1, 0);     top[1] = 1;     dfs1(1, 0);     for (int i = 1; i <= n; i++)       if (fa[i] > 0) {         fang[fa[i]].insert(ss[i]);         if (!cishu[fa[i]].count(ss[i])) cishu[fa[i]][ss[i]] = 0;         cishu[fa[i]][ss[i]]++;       }     for (int i = n + 1; i <= sum; i++) ss[i] = *fang[i].begin();     for (int i = 0; i <= 1000000; i++) seg[i] = INF + 1;     for (int i = 1; i <= sum; i++) put(1, sum, pos[i], 1, ss[i]);     for (int i = 1; i <= q; i++) {       int x, y;       getchar();       scanf( %c%d%d , &ch, &x, &y);       if (ch ==  C ) {         if (fa[x] > 0) {           cishu[fa[x]][ss[x]]--;           if (cishu[fa[x]][ss[x]] == 0) fang[fa[x]].erase(ss[x]);           if (!cishu[fa[x]].count(y)) cishu[fa[x]][y] = 0;           cishu[fa[x]][y]++;           fang[fa[x]].insert(y);           put(1, sum, pos[fa[x]], 1, (*fang[fa[x]].begin()));         }         put(1, sum, pos[x], 1, y);         ss[x] = y;       } else         cout << gettree(x, y) << endl;     }     return 0;   }