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

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.o: B = None
        self.x: C = None
        self.w: D = None
        self.y: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: C = None
        self.v: E = None
        self.p: D = None
        self.txt = txt

m = A("m")
i = B("i")
c = C("c")
n = D("n")
a = E("a")
l = F("l")
h = C("h")
f = D("f")

m.u = a
i.t = c
c.o = f
n.p = i
n.o = i
n.t = h
n.x = c
n.w = f
n.y = f
a.r = i
a.o = m
l.z = i
l.t = h
l.v = a
l.p = f
h.o = n
f.p = i
f.o = i
f.t = h
f.x = h
f.w = n
f.y = n
assert n.x.o.w.t.o.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: C = None
        self.o: B = None
        self.x: C = None
        self.w: D = None
        self.y: D = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.t: C = None
        self.v: E = None
        self.p: D = None
        self.txt = txt

m = A("m")
i = B("i")
c = C("c")
n = D("n")
a = E("a")
l = F("l")
h = C("h")
f = D("f")

m.u = a
i.t = c
c.o = f
n.p = i
n.o = i
n.t = h
n.x = c
n.w = f
n.y = f
a.r = i
a.o = m
l.z = i
l.t = h
l.v = a
l.p = f
h.o = n
f.p = i
f.o = i
f.t = h
f.x = h
f.w = n
f.y = n
assert n.x.o.w.t.o.y.x.txt == "h"