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

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

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

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

h = A("h")
j = B("j")
a = C("a")
n = D("n")

h.t = n
h.r = n
h.w = j
h.p = a
j.v = h
j.r = h
a.u = n
n.o = j
n.r = j
n.z = a
assert n.z.u.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.w: B = None
        self.p: C = None
        self.r: D = None
        self.txt = txt

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

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

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

h = A("h")
j = B("j")
a = C("a")
n = D("n")

h.t = n
h.r = n
h.w = j
h.p = a
j.v = h
j.r = h
a.u = n
n.o = j
n.r = j
n.z = a
assert n.z.u.z.u.txt == "n"