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

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

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

m = A("m")
d = B("d")
j = C("j")
c = B("c")
i = C("i")
h = B("h")
k = A("k")
a = C("a")
g = A("g")
f = C("f")

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

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

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

m = A("m")
d = B("d")
j = C("j")
c = B("c")
i = C("i")
h = B("h")
k = A("k")
a = C("a")
g = A("g")
f = C("f")

m.s = i
d.q = j
j.v = i
j.q = i
c.q = i
i.v = a
i.q = j
h.q = i
k.s = i
a.v = i
a.q = f
g.s = a
f.v = j
f.q = i
assert m.s.q.q.txt == "i"