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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.y: C = None
        self.w: B = None
        self.t: B = None
        self.txt = txt

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

g.v = j
g.z = c
f.s = h
f.q = h
j.y = c
j.w = f
j.t = f
h.s = f
h.q = f
k.v = j
k.z = j
l.v = c
l.z = j
c.y = j
c.w = h
c.t = f
assert f.s.q.q.txt == "h"