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

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.txt = txt

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

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

k.s = j
n.v = b
n.z = b
n.t = c
n.q = k
f.w = k
f.y = k
b.z = n
b.y = c
j.w = k
j.y = k
c.v = b
c.z = b
c.t = n
c.q = k
assert c.q.s.y.s.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: A = None
        self.y: A = None
        self.txt = txt

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

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

k.s = j
n.v = b
n.z = b
n.t = c
n.q = k
f.w = k
f.y = k
b.z = n
b.y = c
j.w = k
j.y = k
c.v = b
c.z = b
c.t = n
c.q = k
assert c.q.s.y.s.y.s.txt == "j"