class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.p: B = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

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

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

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

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

j.q = g
j.p = g
j.y = k
g.z = k
g.t = i
k.x = i
a.z = g
a.y = g
a.r = g
i.z = g
i.y = g
i.r = g
assert j.y.x.y.t.txt == "i"