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

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

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

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

k = A("k")
g = B("g")
j = C("j")
a = D("a")
i = B("i")

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

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

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

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

k = A("k")
g = B("g")
j = C("j")
a = D("a")
i = B("i")

k.u = j
k.o = j
k.t = j
k.p = g
g.z = a
j.y = k
j.x = a
a.y = i
a.w = j
a.x = j
i.z = a
assert g.z.y.z.y.txt == "i"