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

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

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

c = A("c")
i = B("i")
f = C("f")
k = A("k")
h = B("h")
g = C("g")
a = A("a")
d = A("d")
n = B("n")
l = B("l")

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

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

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

c = A("c")
i = B("i")
f = C("f")
k = A("k")
h = B("h")
g = C("g")
a = A("a")
d = A("d")
n = B("n")
l = B("l")

c.o = l
i.v = n
i.y = l
f.q = a
f.z = g
f.o = g
k.o = n
h.v = n
h.y = n
g.q = d
g.z = f
g.o = f
a.o = i
d.o = l
n.v = l
n.y = l
l.v = n
l.y = h
assert d.o.v.v.y.v.v.y.v.v.y.txt == "h"