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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: D = None
        self.t: D = None
        self.txt = txt

h = A("h")
k = B("k")
n = C("n")
a = D("a")
e = E("e")
c = B("c")
b = A("b")
m = E("m")

h.u = n
h.x = n
h.w = n
h.v = c
k.p = c
k.y = c
k.r = h
n.z = k
a.y = m
a.o = k
e.p = a
e.u = a
e.t = a
c.p = k
c.y = k
c.r = h
b.u = n
b.x = n
b.w = n
b.v = k
m.p = a
m.u = a
m.t = a
assert m.u.y.t.o.p.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.v: B = None
        self.x: C = None
        self.w: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.o: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.u: D = None
        self.t: D = None
        self.txt = txt

h = A("h")
k = B("k")
n = C("n")
a = D("a")
e = E("e")
c = B("c")
b = A("b")
m = E("m")

h.u = n
h.x = n
h.w = n
h.v = c
k.p = c
k.y = c
k.r = h
n.z = k
a.y = m
a.o = k
e.p = a
e.u = a
e.t = a
c.p = k
c.y = k
c.r = h
b.u = n
b.x = n
b.w = n
b.v = k
m.p = a
m.u = a
m.t = a
assert m.u.y.t.o.p.r.v.txt == "c"