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

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

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

e = A("e")
h = B("h")
c = C("c")
m = C("m")
i = B("i")
g = C("g")
n = A("n")
b = A("b")
l = B("l")
f = B("f")

e.z = b
e.p = i
e.x = h
h.x = m
h.u = l
h.v = n
c.w = n
c.t = m
m.w = b
m.t = g
i.x = m
i.u = l
i.v = b
g.w = n
g.t = m
n.z = e
n.p = l
n.x = l
b.z = e
b.p = f
b.x = l
l.x = c
l.u = h
l.v = b
f.x = g
f.u = l
f.v = n
assert c.w.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.p: B = None
        self.x: B = None
        self.txt = txt

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

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

e = A("e")
h = B("h")
c = C("c")
m = C("m")
i = B("i")
g = C("g")
n = A("n")
b = A("b")
l = B("l")
f = B("f")

e.z = b
e.p = i
e.x = h
h.x = m
h.u = l
h.v = n
c.w = n
c.t = m
m.w = b
m.t = g
i.x = m
i.u = l
i.v = b
g.w = n
g.t = m
n.z = e
n.p = l
n.x = l
b.z = e
b.p = f
b.x = l
l.x = c
l.u = h
l.v = b
f.x = g
f.u = l
f.v = n
assert c.w.z.z.txt == "b"