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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: E = None
        self.p: C = None
        self.txt = txt

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

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

k.w = d
k.t = d
k.r = c
f.z = k
f.w = a
d.p = k
d.o = n
l.o = d
l.p = d
l.q = a
c.r = d
c.w = a
n.o = d
n.p = d
n.q = a
j.z = k
j.w = a
a.r = d
a.w = c
assert l.p.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: E = None
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: E = None
        self.p: C = None
        self.txt = txt

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

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

k.w = d
k.t = d
k.r = c
f.z = k
f.w = a
d.p = k
d.o = n
l.o = d
l.p = d
l.q = a
c.r = d
c.w = a
n.o = d
n.p = d
n.q = a
j.z = k
j.w = a
a.r = d
a.w = c
assert l.p.o.o.txt == "d"