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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

m = A("m")
i = B("i")
h = C("h")
f = D("f")
e = E("e")
d = D("d")
n = B("n")
a = E("a")

m.v = n
m.q = i
m.u = h
i.y = n
i.u = n
i.p = f
h.x = e
f.x = h
f.o = h
e.q = i
d.x = h
d.o = h
n.y = i
n.u = i
n.p = d
a.q = i
assert f.o.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.q: B = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

m = A("m")
i = B("i")
h = C("h")
f = D("f")
e = E("e")
d = D("d")
n = B("n")
a = E("a")

m.v = n
m.q = i
m.u = h
i.y = n
i.u = n
i.p = f
h.x = e
f.x = h
f.o = h
e.q = i
d.x = h
d.o = h
n.y = i
n.u = i
n.p = d
a.q = i
assert f.o.x.q.txt == "i"