class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.o: E = 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.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: A = None
        self.u: C = None
        self.p: C = None
        self.txt = txt

k = A("k")
j = B("j")
l = C("l")
d = D("d")
n = E("n")
f = B("f")
a = D("a")

k.w = l
k.z = l
k.o = n
j.r = f
l.s = f
d.s = j
d.o = k
d.t = k
n.x = j
n.z = k
n.u = l
n.p = l
f.r = j
a.s = j
a.o = k
a.t = k
assert a.s.r.r.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: C = None
        self.o: E = 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.s: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.z: A = None
        self.u: C = None
        self.p: C = None
        self.txt = txt

k = A("k")
j = B("j")
l = C("l")
d = D("d")
n = E("n")
f = B("f")
a = D("a")

k.w = l
k.z = l
k.o = n
j.r = f
l.s = f
d.s = j
d.o = k
d.t = k
n.x = j
n.z = k
n.u = l
n.p = l
f.r = j
a.s = j
a.o = k
a.t = k
assert a.s.r.r.r.r.r.r.txt == "j"