class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
l = C("l")
k = D("k")
d = E("d")

g.z = l
j.w = g
j.u = d
j.t = l
l.q = g
l.o = j
k.y = g
k.z = g
k.t = j
k.v = j
d.w = l
d.s = l
d.z = l
d.o = l
assert k.y.z.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

g = A("g")
j = B("j")
l = C("l")
k = D("k")
d = E("d")

g.z = l
j.w = g
j.u = d
j.t = l
l.q = g
l.o = j
k.y = g
k.z = g
k.t = j
k.v = j
d.w = l
d.s = l
d.z = l
d.o = l
assert k.y.z.o.w.txt == "g"