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

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

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

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

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

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

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

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

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

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

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

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

k.r = a
a.r = f
e.u = a
j.o = f
j.z = a
j.p = k
j.y = d
c.t = e
c.q = f
c.y = k
d.o = f
d.z = a
d.p = n
d.y = j
f.r = a
n.r = f
m.t = e
m.q = a
m.y = n
assert e.u.r.r.r.txt == "f"