class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.p: E = None
        self.s: F = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: E = None
        self.y: H = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

m = A("m")
d = B("d")
l = C("l")
k = D("k")
a = E("a")
h = F("h")
e = G("e")
f = H("f")
n = C("n")
b = F("b")

m.q = f
m.p = a
m.s = h
m.r = k
d.u = h
d.q = a
d.y = f
d.s = n
d.o = k
l.y = f
k.o = m
a.q = n
a.t = b
h.u = d
e.s = f
e.o = d
f.t = a
n.y = f
b.u = d
assert n.y.t.t.u.s.y.t.t.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.q: H = None
        self.p: E = None
        self.s: F = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.q: E = None
        self.y: H = None
        self.s: C = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.s: H = None
        self.o: B = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

m = A("m")
d = B("d")
l = C("l")
k = D("k")
a = E("a")
h = F("h")
e = G("e")
f = H("f")
n = C("n")
b = F("b")

m.q = f
m.p = a
m.s = h
m.r = k
d.u = h
d.q = a
d.y = f
d.s = n
d.o = k
l.y = f
k.o = m
a.q = n
a.t = b
h.u = d
e.s = f
e.o = d
f.t = a
n.y = f
b.u = d
assert n.y.t.t.u.s.y.t.t.u.s.txt == "n"