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

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

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

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

a = A("a")
j = B("j")
l = C("l")
n = D("n")
c = A("c")
k = D("k")
m = A("m")
b = B("b")

a.v = b
j.t = m
l.t = j
l.z = m
l.q = c
n.z = l
n.t = l
n.v = b
n.p = a
c.v = j
k.z = l
k.t = l
k.v = b
k.p = m
m.v = b
b.t = m
assert c.v.t.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

a = A("a")
j = B("j")
l = C("l")
n = D("n")
c = A("c")
k = D("k")
m = A("m")
b = B("b")

a.v = b
j.t = m
l.t = j
l.z = m
l.q = c
n.z = l
n.t = l
n.v = b
n.p = a
c.v = j
k.z = l
k.t = l
k.v = b
k.p = m
m.v = b
b.t = m
assert c.v.t.v.txt == "b"