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

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

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

c = A("c")
g = B("g")
m = C("m")
k = C("k")
d = B("d")
h = B("h")
i = C("i")
f = C("f")
n = A("n")
a = B("a")

c.w = k
c.q = a
c.u = i
g.x = c
g.w = m
g.r = m
m.r = g
m.z = h
m.t = d
k.r = d
k.z = d
k.t = d
d.x = c
d.w = m
d.r = i
h.x = n
h.w = f
h.r = f
i.r = d
i.z = d
i.t = h
f.r = h
f.z = d
f.t = d
n.w = k
n.q = h
n.u = i
a.x = c
a.w = k
a.r = m
assert a.w.t.w.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.q: B = None
        self.u: C = None
        self.txt = txt

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

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

c = A("c")
g = B("g")
m = C("m")
k = C("k")
d = B("d")
h = B("h")
i = C("i")
f = C("f")
n = A("n")
a = B("a")

c.w = k
c.q = a
c.u = i
g.x = c
g.w = m
g.r = m
m.r = g
m.z = h
m.t = d
k.r = d
k.z = d
k.t = d
d.x = c
d.w = m
d.r = i
h.x = n
h.w = f
h.r = f
i.r = d
i.z = d
i.t = h
f.r = h
f.z = d
f.t = d
n.w = k
n.q = h
n.u = i
a.x = c
a.w = k
a.r = m
assert a.w.t.w.r.x.txt == "c"