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

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

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

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

j = A("j")
c = B("c")
f = C("f")
b = D("b")
i = B("i")
k = B("k")
n = C("n")
e = D("e")

j.x = f
j.z = f
j.u = b
c.z = j
c.w = j
f.x = i
f.s = j
b.v = k
b.p = n
b.x = e
i.z = j
i.w = j
k.z = j
k.w = j
n.x = i
n.s = j
e.v = i
e.p = f
e.x = b
assert c.z.z.s.u.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: D = None
        self.z: C = None
        self.txt = txt

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

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

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

j = A("j")
c = B("c")
f = C("f")
b = D("b")
i = B("i")
k = B("k")
n = C("n")
e = D("e")

j.x = f
j.z = f
j.u = b
c.z = j
c.w = j
f.x = i
f.s = j
b.v = k
b.p = n
b.x = e
i.z = j
i.w = j
k.z = j
k.w = j
n.x = i
n.s = j
e.v = i
e.p = f
e.x = b
assert c.z.z.s.u.p.s.txt == "j"