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

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

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

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

l = A("l")
n = B("n")
c = C("c")
h = D("h")
i = A("i")
j = B("j")
d = A("d")
k = C("k")
m = D("m")

l.o = c
n.s = j
c.v = i
c.y = n
c.z = k
h.x = c
h.p = m
h.q = k
h.w = n
i.o = c
j.s = n
d.o = k
k.v = i
k.y = n
k.z = c
m.x = k
m.p = h
m.q = c
m.w = n
assert c.v.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

l = A("l")
n = B("n")
c = C("c")
h = D("h")
i = A("i")
j = B("j")
d = A("d")
k = C("k")
m = D("m")

l.o = c
n.s = j
c.v = i
c.y = n
c.z = k
h.x = c
h.p = m
h.q = k
h.w = n
i.o = c
j.s = n
d.o = k
k.v = i
k.y = n
k.z = c
m.x = k
m.p = h
m.q = c
m.w = n
assert c.v.o.z.txt == "k"