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

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.p: D = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: A = None
        self.txt = txt

k = A("k")
m = B("m")
f = C("f")
n = D("n")
i = E("i")
j = E("j")
l = B("l")
h = E("h")
a = C("a")

k.t = n
m.v = j
m.u = k
f.u = n
f.p = n
f.q = k
f.s = m
f.w = a
n.r = f
n.w = m
i.r = h
i.y = k
j.r = i
j.y = k
l.v = j
l.u = k
h.r = j
h.y = k
a.u = n
a.p = n
a.q = k
a.s = l
a.w = f
assert j.y.t.r.q.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: E = None
        self.u: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: D = None
        self.q: A = None
        self.p: D = None
        self.s: B = None
        self.w: C = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: E = None
        self.y: A = None
        self.txt = txt

k = A("k")
m = B("m")
f = C("f")
n = D("n")
i = E("i")
j = E("j")
l = B("l")
h = E("h")
a = C("a")

k.t = n
m.v = j
m.u = k
f.u = n
f.p = n
f.q = k
f.s = m
f.w = a
n.r = f
n.w = m
i.r = h
i.y = k
j.r = i
j.y = k
l.v = j
l.u = k
h.r = j
h.y = k
a.u = n
a.p = n
a.q = k
a.s = l
a.w = f
assert j.y.t.r.q.t.txt == "n"