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

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

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

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

b.y = g
b.v = c
b.q = c
k.v = b
j.z = c
j.s = l
f.v = b
l.v = h
a.y = c
a.q = c
a.v = j
c.z = g
c.s = f
g.z = c
g.s = i
h.y = j
h.v = g
h.q = c
i.v = h
assert b.q.s.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.v: C = None
        self.q: C = None
        self.txt = txt

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

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

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

b.y = g
b.v = c
b.q = c
k.v = b
j.z = c
j.s = l
f.v = b
l.v = h
a.y = c
a.q = c
a.v = j
c.z = g
c.s = f
g.z = c
g.s = i
h.y = j
h.v = g
h.q = c
i.v = h
assert b.q.s.v.txt == "b"