import std.stdio;
import std.ascii;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

const NF = "NF";

class Node {
    string name;
    Node parent;
    Node[string] children;
    this(string name, Node parent) {
        this.name = name;
        this.parent = parent;
        this.children["."] = this;
        this.children[".."] = parent;
    }
    void add(string[] path) {
        //writeln("(add) ", name, ": ", path);
        assert(path.front == name);
        path.popFront;
        if (path.empty) return;
        if (path.front !in children) {
            children[path.front] = new Node(path.front, this);
        }
        children[path.front].add(path);
    }
    Node query(string[] path) {
        //writeln("(query) ", name, ": ", path);
        assert(path.front == name || path.front == "." || path.front == "..");
        path.popFront;
        if (path.empty) {
            return this;
        }
        if (path.front in children && children[path.front] !is null && isDir) {
            return children[path.front].query(path);
        }
        return null;
    }
    bool isDir() {
        return children.length > 2;
    }
    bool isFile() {
        return !isDir;
    }
}

void main() {
    int N, M;
    Node root = new Node("", null);
    bool solve() {
        scanf("%d %d\n", &N, &M);
        if (N == 0 && M == 0) return false;
        foreach (i; 0 .. N) {
            root.add(readln.chomp.chomp("/").split("/"));
        }
        foreach (i; 0 .. M) {
            auto a = readln.chomp,
                 b = readln.chomp;
            bool filea, fileb;
            if (a.back == '/') {
                a ~= "index.html";
                filea = true;
            }
            if (b.back == '/') {
                b ~= "index.html";
                fileb = true;
            }
            auto qa = a.split("/"),
                 qb = b.split("/");
            auto x = root.query(qa),
                 y = root.query(qb);
            if (x is null || y is null) {
                writeln("not found"); continue;
            }
            if (filea && x.isDir) x = null;
            if (filea && y.isDir) y = null;
            if (!filea && x.isDir) {
                x = root.query( (a ~ "/index.html").split("/") );
                if (x !is null && x.isDir) x = null;
            }
            if (!fileb && y.isDir) {
                y = root.query( (b ~ "/index.html").split("/") );
                if (y !is null && y.isDir) y = null;

            }
            if (x is null || y is null) {
                writeln("not found"); continue;
            }
            writeln(x == y ? "yes" : "no");
        }
        return true;
    }
    while (solve) {}
}