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

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

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

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

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

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

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

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

i.t = n
i.u = d
d.x = e
d.w = g
d.z = i
b.w = i
b.q = k
g.w = n
g.q = b
j.w = n
j.q = k
n.t = i
n.u = h
h.x = e
h.w = g
h.z = i
k.w = i
k.q = g
e.x = h
e.w = k
e.z = i
assert j.w.t.u.z.u.w.q.txt == "b"