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

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

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

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

c = A("c")
j = B("j")
e = C("e")
n = D("n")

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

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

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

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

c = A("c")
j = B("j")
e = C("e")
n = D("n")

c.z = n
c.x = n
c.t = j
j.u = n
j.v = c
e.u = n
e.w = n
n.y = e
n.u = j
n.s = j
assert c.t.v.t.v.txt == "c"