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

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

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

g = A("g")
f = B("f")
b = C("b")
k = A("k")
h = A("h")
d = B("d")
e = C("e")
i = C("i")

g.t = f
g.q = b
g.o = e
f.q = d
f.z = d
f.w = h
b.t = f
b.q = h
k.t = f
k.q = e
k.o = e
h.t = d
h.q = e
h.o = e
d.q = f
d.z = f
d.w = h
e.t = d
e.q = g
i.t = f
i.q = h
assert i.q.t.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.q: C = None
        self.o: C = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
b = C("b")
k = A("k")
h = A("h")
d = B("d")
e = C("e")
i = C("i")

g.t = f
g.q = b
g.o = e
f.q = d
f.z = d
f.w = h
b.t = f
b.q = h
k.t = f
k.q = e
k.o = e
h.t = d
h.q = e
h.o = e
d.q = f
d.z = f
d.w = h
e.t = d
e.q = g
i.t = f
i.q = h
assert i.q.t.w.txt == "h"