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

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

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

l = A("l")
g = B("g")
c = C("c")
b = B("b")
f = C("f")
a = A("a")
j = C("j")
n = B("n")

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

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

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

l = A("l")
g = B("g")
c = C("c")
b = B("b")
f = C("f")
a = A("a")
j = C("j")
n = B("n")

l.y = a
l.q = b
g.v = l
g.t = c
g.o = f
c.v = j
c.z = l
b.v = l
b.t = j
b.o = f
f.v = j
f.z = a
a.y = l
a.q = b
j.v = c
j.z = a
n.v = l
n.t = f
n.o = c
assert n.v.y.y.y.q.txt == "b"