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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.q: D = None
        self.v: D = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
l = C("l")
d = D("d")
a = D("a")
j = D("j")

h.v = k
k.o = l
k.u = a
k.q = d
k.v = j
l.u = d
l.w = h
l.r = j
d.y = h
d.z = h
d.o = h
a.y = h
a.z = h
a.o = h
j.y = h
j.z = h
j.o = h
assert k.q.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.q: D = None
        self.v: D = None
        self.txt = txt

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

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

h = A("h")
k = B("k")
l = C("l")
d = D("d")
a = D("a")
j = D("j")

h.v = k
k.o = l
k.u = a
k.q = d
k.v = j
l.u = d
l.w = h
l.r = j
d.y = h
d.z = h
d.o = h
a.y = h
a.z = h
a.o = h
j.y = h
j.z = h
j.o = h
assert k.q.z.v.txt == "k"