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

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

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

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

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

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

h.r = j
h.u = j
h.t = a
h.o = l
k.v = h
a.x = m
a.y = l
a.s = k
j.o = a
j.q = a
j.x = m
m.t = k
m.u = k
m.r = k
m.p = j
l.r = j
l.u = j
l.t = a
l.o = h
assert m.p.x.p.o.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.t: C = None
        self.o: A = None
        self.u: D = None
        self.txt = txt

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

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

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

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

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

h.r = j
h.u = j
h.t = a
h.o = l
k.v = h
a.x = m
a.y = l
a.s = k
j.o = a
j.q = a
j.x = m
m.t = k
m.u = k
m.r = k
m.p = j
l.r = j
l.u = j
l.t = a
l.o = h
assert m.p.x.p.o.x.p.txt == "j"