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

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

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

e = A("e")
b = B("b")
f = C("f")
d = B("d")
n = B("n")
c = B("c")
h = A("h")
m = A("m")
a = B("a")

e.w = a
e.u = h
b.q = c
b.s = f
b.v = f
f.z = n
f.v = m
f.u = d
d.q = b
d.s = f
d.v = f
n.q = c
n.s = f
n.v = f
c.q = d
c.s = f
c.v = f
h.w = d
h.u = m
m.w = a
m.u = e
a.q = b
a.s = f
a.v = f
assert e.w.v.u.q.q.v.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.u: A = None
        self.txt = txt

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

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

e = A("e")
b = B("b")
f = C("f")
d = B("d")
n = B("n")
c = B("c")
h = A("h")
m = A("m")
a = B("a")

e.w = a
e.u = h
b.q = c
b.s = f
b.v = f
f.z = n
f.v = m
f.u = d
d.q = b
d.s = f
d.v = f
n.q = c
n.s = f
n.v = f
c.q = d
c.s = f
c.v = f
h.w = d
h.u = m
m.w = a
m.u = e
a.q = b
a.s = f
a.v = f
assert e.w.v.u.q.q.v.z.v.txt == "f"