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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: B = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

h = A("h")
m = B("m")
k = C("k")
l = D("l")
e = E("e")
f = A("f")
n = A("n")

h.r = k
h.t = l
h.p = m
m.y = f
m.o = k
m.t = h
m.u = h
k.u = n
l.z = k
l.r = m
l.t = e
l.q = e
e.u = h
e.y = l
f.r = k
f.t = l
f.p = m
n.r = k
n.t = l
n.p = m
assert h.p.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: D = None
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.r: B = None
        self.t: E = None
        self.q: E = None
        self.txt = txt

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

h = A("h")
m = B("m")
k = C("k")
l = D("l")
e = E("e")
f = A("f")
n = A("n")

h.r = k
h.t = l
h.p = m
m.y = f
m.o = k
m.t = h
m.u = h
k.u = n
l.z = k
l.r = m
l.t = e
l.q = e
e.u = h
e.y = l
f.r = k
f.t = l
f.p = m
n.r = k
n.t = l
n.p = m
assert h.p.y.t.txt == "l"