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

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

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

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

l = A("l")
g = B("g")
j = C("j")
f = D("f")
i = D("i")
c = B("c")
h = A("h")
n = A("n")
k = C("k")
b = B("b")

l.v = n
l.z = c
l.q = j
l.p = i
g.v = j
g.p = l
g.z = c
g.s = h
j.w = i
j.y = c
j.z = h
j.o = k
f.r = n
i.r = n
c.v = j
c.p = n
c.s = n
c.z = b
h.v = l
h.z = g
h.q = j
h.p = i
n.v = l
n.z = b
n.q = j
n.p = f
k.w = f
k.y = c
k.z = n
k.o = j
b.v = k
b.p = n
b.s = n
b.z = g
assert b.v.z.v.q.w.r.z.z.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: B = None
        self.q: C = None
        self.p: D = None
        self.txt = txt

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

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

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

l = A("l")
g = B("g")
j = C("j")
f = D("f")
i = D("i")
c = B("c")
h = A("h")
n = A("n")
k = C("k")
b = B("b")

l.v = n
l.z = c
l.q = j
l.p = i
g.v = j
g.p = l
g.z = c
g.s = h
j.w = i
j.y = c
j.z = h
j.o = k
f.r = n
i.r = n
c.v = j
c.p = n
c.s = n
c.z = b
h.v = l
h.z = g
h.q = j
h.p = i
n.v = l
n.z = b
n.q = j
n.p = f
k.w = f
k.y = c
k.z = n
k.o = j
b.v = k
b.p = n
b.s = n
b.z = g
assert b.v.z.v.q.w.r.z.z.p.z.txt == "c"