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

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

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

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

c = A("c")
j = B("j")
e = C("e")
i = D("i")
m = B("m")
g = A("g")

c.t = i
c.v = i
c.w = m
c.u = m
j.z = e
j.x = m
e.s = g
i.o = e
m.z = e
m.x = j
g.t = i
g.v = i
g.w = j
g.u = j
assert c.t.o.s.t.o.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: B = None
        self.v: D = None
        self.u: B = None
        self.txt = txt

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

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

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

c = A("c")
j = B("j")
e = C("e")
i = D("i")
m = B("m")
g = A("g")

c.t = i
c.v = i
c.w = m
c.u = m
j.z = e
j.x = m
e.s = g
i.o = e
m.z = e
m.x = j
g.t = i
g.v = i
g.w = j
g.u = j
assert c.t.o.s.t.o.txt == "e"