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

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

k = A("k")
a = B("a")
j = A("j")
d = A("d")
c = B("c")
n = A("n")
e = B("e")
i = B("i")
h = B("h")
l = A("l")

k.v = i
a.y = j
a.q = l
j.v = h
d.v = e
c.y = n
c.q = j
n.v = c
e.y = n
e.q = j
i.y = d
i.q = l
h.y = l
h.q = d
l.v = h
assert c.q.v.q.v.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

k = A("k")
a = B("a")
j = A("j")
d = A("d")
c = B("c")
n = A("n")
e = B("e")
i = B("i")
h = B("h")
l = A("l")

k.v = i
a.y = j
a.q = l
j.v = h
d.v = e
c.y = n
c.q = j
n.v = c
e.y = n
e.q = j
i.y = d
i.q = l
h.y = l
h.q = d
l.v = h
assert c.q.v.q.v.q.v.txt == "h"