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

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.u: E = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

k.v = f
f.o = k
f.u = a
f.q = m
c.r = a
c.x = h
c.t = k
h.r = f
h.y = f
h.p = l
h.u = a
h.q = c
d.t = n
l.r = f
l.y = f
l.p = h
l.u = n
l.q = c
m.t = n
n.t = d
a.t = n
assert m.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: B = None
        self.p: D = None
        self.u: E = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

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

k.v = f
f.o = k
f.u = a
f.q = m
c.r = a
c.x = h
c.t = k
h.r = f
h.y = f
h.p = l
h.u = a
h.q = c
d.t = n
l.r = f
l.y = f
l.p = h
l.u = n
l.q = c
m.t = n
n.t = d
a.t = n
assert m.t.t.t.txt == "n"