inputs = (gets).split(" ")
I = inputs[0].to_i
J = inputs[1].to_i
Q = inputs[2].to_i

road_i = []
(gets).chars do |c|
  case c
    when 'W'
      road_i << false
    when 'E'
      road_i << true
    else
      break
  end
end

road_j = []
(gets).chars do |c|
  case c
    when 'N'
      road_j << false
    when 'S'
      road_j << true
    else
      break
  end
end

class Dijkstra
  def initialize(ii, jj)
      @iwe = ii.dup
      @jns = jj.dup
      @blist = []
      @amap = []
      @safe = 0
      #p @iwe
      #p @jns
  end

  def blist_add(p, expand=false)
      i,j,d = p
      @blist << p
      if expand then
          @blist << [i-1, j] if (i > 0 && @jns[j])
          @blist << [i+1, j] if (i < I-1 && !@jns[j])
          @blist << [i, j-1] if (j > 0 && @iwe[i])
          @blist << [i, j+1] if (j < J-1 && !@iwe[i])
      end
  end
  def blist_check(ps)
      rps = []
      ps.each do |p|
          p2 = p[0..1]
          if not @blist.include?(p2) then
              rps << p
              @blist << p2
          end
      end
      #p rps
      #@blist = @blist + rps if not rps.length == 0
      return rps
  end
  def blist_rm(p)
      @blist.reject!{ |i,j| i==p[0] && j==p[1] }
  end
  def blist_clear()
      @blist = []
  end

  def amap_add(i,j,ps)
      if @amap[i*J+j].nil? then
          @amap[i*J+j] = [ps]
      else
          @amap[i*J+j].push(ps)
      end
  end
  def amap_search(p1, p2)
      am = @amap[p2[0]*J+p2[1]]
      gs = [p2]
      ret = -1
      if am.nil? then
          return ret,gs
      end
      am.each do |m|
          if ( ix = m.index(p1) ).nil? then
              gs = gs + m # 直接の経路がなければ途中までの地点すべてをゴールにする
          else
              ret = m.length - ix
              #puts "! find !"
              break
          end
      end
      return ret,gs
  end
  def amap_dist_andExpand(p1, p2, pa)
      am = @amap[p2[0]*J+p2[1]]
      gaps = []
      buf = am.dup
      #puts "---"
      #p buf
      am.each do |m|
          ix = m.index(p1)
          if not ix.nil? then
              m2 = m[ix..(m.length-1)]
              #p m2
              #ixs << ix
              buf.push(pa[2] + m2)
              #p pa[2]
              gaps << m2.length
          end
      end
      am = buf
      #p am
      #puts "---"
      return gaps.max
  end

  def next_get(p)
      rp = []
      buf = p[2].dup
      i = p[0]
      j = p[1]
      buf.push(p[0..1])
      rp[rp.length] = [i-1, j, buf] if (i > 0 && !@jns[j])
      rp[rp.length] = [i+1, j, buf] if (i < I-1 && @jns[j])
      rp[rp.length] = [i, j-1, buf] if (j > 0 && !@iwe[i])
      rp[rp.length] = [i, j+1, buf] if (j < J-1 && @iwe[i])
      #p rp
      rp.each do |i,j|
          amap_add(i, j, buf)
      end
      #puts "(#{i}, #{j})"
      #p rp
      return blist_check(rp)
  end

  def search(p1, p2)
      blist_clear()
      #p p1
      #p p2
      dist,goals = amap_search(p1, p2)
      gap = 0
      if dist >= 0 then
          return dist
      end
      #p goals
      pos = []
      pos << [p1[0], p1[1], []] # pos/poの２つめの要素は通ってきたものを示す
      isGoal = false
      ds = []
      #p pos
      blist_add(p1)
      #blist_add(p2)
      blist_rm(p2)
      #while @safe < 12
      while true
          #@safe = @safe + 1
          buf = []
          if pos.length == 0 then
              #pos << [-1, -1, []]
              #puts "end"
              break
          end
          #p pos
          pos.map! do |po|
              #isReach = false
              nps = next_get(po)
              #if nps.length == 0 then
              #    po[0] = -1
              #    next
              #end
              #p "---"
              #p nps
              goals.each.with_index do |g, ix|
                if not ( arrived = nps.find{ |i,j| (i==g[0] && j==g[1]) } ).nil? then
                  #buf << arrived
                  if ix != 0 then
                      #isReach = true
                      gap = amap_dist_andExpand(g, p2, arrived)
                      ds << (arrived[2].length + gap)
                      #p arrived
                      arrived[0] = -1
                      #puts "gap = #{gap} : (#{g[0]}, #{g[1]})"
                      #p arrived[2]
                 else
                      #puts ">> Goal! <<"
                      isGoal = true
                      ds << (arrived[2].length)
                      break
                  end
                end #find
              end #each
              nps.reject! {|i,j| i == -1}
              #p nps
              buf = buf + nps #if not isReach
          end #pos
          pos = buf.dup
          #puts "---"
          #p pos
          #p @blist
          break if isGoal
      end
      #p pos
      #return isGoal ? pos[0][2].length+gap : -1
      #p ds
      return ds.length > 0 ? ds.min : -1
  end
end

dik = Dijkstra.new(road_i, road_j)
answers = []
Q.times do
    ins = (gets).split(" ").map{|g| g.to_i - 1}
    dist = dik.search([ins[0], ins[1]], [ins[2], ins[3]])
    answers << dist
end

answers.each {|ans| puts ans}