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

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

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

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

k = A("k")
c = B("c")
l = C("l")
j = D("j")

k.r = l
k.t = l
k.v = j
c.s = k
l.x = k
l.v = k
j.s = k
j.p = k
j.z = c
j.u = c
assert c.s.t.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
l = C("l")
j = D("j")

k.r = l
k.t = l
k.v = j
c.s = k
l.x = k
l.v = k
j.s = k
j.p = k
j.z = c
j.u = c
assert c.s.t.x.v.txt == "j"