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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.s: C = None
        self.o: C = None
        self.z: B = None
        self.txt = txt

g = A("g")
b = B("b")
a = C("a")
k = D("k")
f = E("f")

g.t = a
g.u = a
g.x = b
b.x = a
a.v = g
a.w = k
k.x = g
k.w = g
f.y = b
f.z = b
f.u = k
f.s = a
f.o = a
assert k.w.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.u: C = None
        self.x: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: B = None
        self.u: D = None
        self.s: C = None
        self.o: C = None
        self.z: B = None
        self.txt = txt

g = A("g")
b = B("b")
a = C("a")
k = D("k")
f = E("f")

g.t = a
g.u = a
g.x = b
b.x = a
a.v = g
a.w = k
k.x = g
k.w = g
f.y = b
f.z = b
f.u = k
f.s = a
f.o = a
assert k.w.x.x.txt == "a"