class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.y: A = None
        self.r: A = None
        self.txt = txt

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

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

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

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

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

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

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

e.u = f
e.y = n
e.r = n
d.t = c
d.z = h
d.u = f
i.s = d
i.w = d
m.t = n
m.z = k
m.u = f
k.s = d
k.w = m
g.t = c
g.z = h
g.u = k
c.u = h
c.y = e
c.r = n
h.s = m
h.w = d
f.s = g
f.w = d
n.u = f
n.y = e
n.r = e
assert n.u.s.t.r.y.u.w.u.s.txt == "g"