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

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

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

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

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

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

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

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

g.x = k
b.w = d
b.q = f
k.w = j
k.q = b
k.s = g
c.w = b
c.q = f
d.w = c
d.q = a
h.x = a
j.x = f
f.w = j
f.s = j
f.q = c
a.w = i
a.q = c
a.s = j
i.x = a
assert h.x.q.w.txt == "b"