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

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

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

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

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

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

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

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

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

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

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

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

a.w = e
a.t = b
e.t = c
k.q = e
k.v = l
k.z = l
k.w = a
k.y = a
b.u = l
b.o = l
l.q = k
l.p = c
m.u = l
m.o = l
j.w = e
j.t = n
c.u = l
c.o = l
n.u = l
n.o = l
f.w = e
f.t = b
assert b.o.p.u.q.w.txt == "a"