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

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

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

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

d = A("d")
j = B("j")
n = C("n")
l = D("l")
a = B("a")
g = C("g")
b = C("b")

d.w = a
d.t = j
d.z = l
j.w = l
j.y = d
n.u = a
l.w = d
l.z = j
a.w = l
a.y = d
g.u = j
b.u = j
assert g.u.y.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.t: B = None
        self.z: D = None
        self.txt = txt

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

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

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

d = A("d")
j = B("j")
n = C("n")
l = D("l")
a = B("a")
g = C("g")
b = C("b")

d.w = a
d.t = j
d.z = l
j.w = l
j.y = d
n.u = a
l.w = d
l.z = j
a.w = l
a.y = d
g.u = j
b.u = j
assert g.u.y.z.z.txt == "j"