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

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

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

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

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

m = A("m")
j = B("j")
f = C("f")
l = D("l")
n = E("n")
a = E("a")
h = C("h")

m.p = j
m.x = n
j.v = a
j.q = l
f.r = m
l.w = j
l.o = m
l.v = m
n.t = f
n.s = f
n.u = a
a.t = h
a.s = h
a.u = n
h.r = m
assert m.x.u.t.r.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: E = None
        self.txt = txt

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

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

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

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

m = A("m")
j = B("j")
f = C("f")
l = D("l")
n = E("n")
a = E("a")
h = C("h")

m.p = j
m.x = n
j.v = a
j.q = l
f.r = m
l.w = j
l.o = m
l.v = m
n.t = f
n.s = f
n.u = a
a.t = h
a.s = h
a.u = n
h.r = m
assert m.x.u.t.r.x.u.txt == "a"