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

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

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

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

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

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

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

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

c.q = h
c.x = k
c.t = d
g.v = b
g.z = k
g.w = i
k.s = b
f.s = b
e.v = g
e.z = k
e.w = i
b.v = g
b.z = d
b.w = c
h.q = i
h.x = f
h.t = k
i.q = c
i.x = f
i.t = f
d.s = b
assert d.s.z.s.v.w.q.q.txt == "h"