import scala.collection.immutable.Nil
import scala.collection.mutable

object Main extends App {
  import scala.io.StdIn._


  solve
  def solve: Unit = {
    val Array(n, m) = readLine.trim.split(' ').map(_.toInt)
    if (n == 0) return
    val root = Directory.createRoot
    for (file ← Array.tabulate(n){_ ⇒ readLine.trim}) {
      root.createFile(file)
    }
    for (_ ← 0 until m){
      val first = readLine.trim
      val second = readLine.trim
      println(root.findFile(first).flatMap(a ⇒ root.findFile(second).map(_ == a)) match {
        case Some(true) ⇒ "yes"
        case Some(false) ⇒ "no"
        case None ⇒ "not found"
      })
    }
    solve
  }
  def isSamePath(a: List[String], b: List[String]): Boolean = {
    (a, b) match {
      case (Nil, Nil) ⇒ true
      case (ha::ta, hb::tb) ⇒ ha == hb == isSamePath(ta, tb)
      case _ ⇒ false
    }
  }
  object Directory{
    def createRoot: Directory = new Folder
    class File extends Directory {
      override def walkDirectories(path: List[PathToken]): Either[List[PathToken], Option[File]] = {
        path match {
          case Nil ⇒ Right(Some(this))
          case _ ⇒ Right(None)
        }
      }

      override def createFile(path: List[PathToken]): Unit = {}
    }
    class Folder extends Directory {
      private[this] val subDirectory: mutable.Map[String, Directory] = mutable.Map[String, Directory]()

      override def createFile(path: List[PathToken]): Unit = {
        path match {
          case Nil if !subDirectory.contains("index.html") ⇒ subDirectory("index.html") = new File
          case Ambiguous(name)::Nil if !subDirectory.contains(name) ⇒ subDirectory(name) = new File
          case DirectoryName(folder)::t if !subDirectory.contains(folder) ⇒ subDirectory(folder) = new Folder().also(f ⇒ f.createFile(t))
          case DirectoryName(folder)::t ⇒ subDirectory(folder).createFile(t)
          case _ ⇒ ???
        }
      }
      override def walkDirectories(path: List[PathToken]): Either[List[PathToken], Option[File]] = {
        path match {
          case Nil ⇒ Right(subDirectory.get("index.html").filter(_.isInstanceOf[File]).map(_.asInstanceOf[File]))
          case DirectoryName(".")::t ⇒ walkDirectories(t)
          case DirectoryName("..")::t ⇒ Left(t)
          case Ambiguous(name)::Nil if subDirectory.contains(name) ⇒
            subDirectory(name) match {
              case file: File ⇒ Right(Some(file))
              case directory: Folder ⇒ directory.walkDirectories(Nil)
            }
          case DirectoryName(name)::t if subDirectory.contains(name) ⇒
            subDirectory(name) match {
              case _: File ⇒ Right(None)
              case directory: Folder ⇒
                directory.walkDirectories(t) match {
                  case Left(p) ⇒ walkDirectories(p)
                  case r ⇒ r
                }
            }
          case _ ⇒ Right(None)

        }
      }
    }
  }
  sealed trait Directory {
    final def findFile(path: String): Option[Directory.File] = {
      walkDirectories(PathParser.parse(path)) match {
        case Right(r) ⇒ r
        case _ ⇒ None
      }
    }
    protected def walkDirectories(path: List[PathToken]): Either[List[PathToken], Option[Directory.File]]
    final def createFile(path: String): Unit = createFile(PathParser.parse(path))
    protected def createFile(path: List[PathToken]): Unit//index.html Must
  }
  sealed trait PathToken {
    def name: String
  }
  case class DirectoryName(name: String) extends PathToken
  case class Ambiguous(name: String) extends PathToken
  object PathParser{
    private[this] val htmlFile = """^(\w+\.html)$""".r
    def parse(path: String): List[PathToken] = {
      parse(path.toList)
    }
    private[this] def parse(path: List[Char]): List[PathToken] = {// "/"で始まる
      path.tail.span(_ != '/') match {
        case (Nil, Nil) ⇒ Nil
        case ('.'::Nil, Nil) ⇒ List(DirectoryName("."))
        case ('.'::'.'::Nil, Nil) ⇒ List(DirectoryName(".."))
        case (name, Nil) ⇒ List(Ambiguous(name.mkString))
        case (name, t) ⇒ DirectoryName(name.mkString)::parse(t)
      }
    }
  }
  implicit class Scope[T](val value: T) extends AnyVal {
    @inline
    def also(@inline func: T ⇒ Unit): T = {
      func(value)
      value
    }
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
  }
}


Measured memory_bytes: 45360