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

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

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

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

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

j.x = b
j.p = c
j.w = c
c.v = k
c.t = k
c.u = b
c.y = j
k.t = b
b.x = k
b.v = k
assert j.p.y.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

j.x = b
j.p = c
j.w = c
c.v = k
c.t = k
c.u = b
c.y = j
k.t = b
b.x = k
b.v = k
assert j.p.y.p.t.txt == "k"