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

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

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

l = A("l")
b = B("b")
e = C("e")
d = C("d")
k = B("k")
m = B("m")
h = C("h")
a = A("a")

l.o = a
l.y = a
l.v = k
b.v = l
b.q = h
e.z = b
e.x = l
d.z = m
d.x = l
k.v = l
k.q = e
m.v = l
m.q = e
h.z = m
h.x = a
a.o = l
a.y = l
a.v = m
assert k.v.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: A = None
        self.v: B = None
        self.txt = txt

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

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

l = A("l")
b = B("b")
e = C("e")
d = C("d")
k = B("k")
m = B("m")
h = C("h")
a = A("a")

l.o = a
l.y = a
l.v = k
b.v = l
b.q = h
e.z = b
e.x = l
d.z = m
d.x = l
k.v = l
k.q = e
m.v = l
m.q = e
h.z = m
h.x = a
a.o = l
a.y = l
a.v = m
assert k.v.v.q.txt == "e"