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

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

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

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

d = A("d")
j = B("j")
h = C("h")
i = D("i")
g = B("g")
e = D("e")
k = C("k")
b = A("b")

d.t = h
d.x = b
j.z = h
h.s = g
i.w = d
i.r = j
i.t = h
i.o = h
g.z = h
e.w = b
e.r = g
e.t = h
e.o = h
k.s = g
b.t = h
b.x = d
assert b.x.x.x.x.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.x: A = None
        self.txt = txt

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

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

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

d = A("d")
j = B("j")
h = C("h")
i = D("i")
g = B("g")
e = D("e")
k = C("k")
b = A("b")

d.t = h
d.x = b
j.z = h
h.s = g
i.w = d
i.r = j
i.t = h
i.o = h
g.z = h
e.w = b
e.r = g
e.t = h
e.o = h
k.s = g
b.t = h
b.x = d
assert b.x.x.x.x.t.s.txt == "g"