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

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

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

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

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

c = A("c")
g = B("g")
h = C("h")
k = D("k")
m = E("m")
n = C("n")
j = D("j")

c.r = g
g.p = h
h.u = g
h.o = n
k.o = m
m.y = j
m.s = n
m.z = h
m.w = k
m.x = c
n.u = g
n.o = h
j.o = m
assert h.u.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
h = C("h")
k = D("k")
m = E("m")
n = C("n")
j = D("j")

c.r = g
g.p = h
h.u = g
h.o = n
k.o = m
m.y = j
m.s = n
m.z = h
m.w = k
m.x = c
n.u = g
n.o = h
j.o = m
assert h.u.p.u.p.txt == "h"