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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
g = C("g")
e = D("e")
h = E("h")
l = E("l")
f = C("f")
m = A("m")
a = C("a")

k.p = e
k.r = m
k.y = c
c.z = e
g.t = h
e.z = l
e.y = m
h.s = e
h.q = a
l.s = e
l.q = g
f.t = h
m.p = e
m.r = k
m.y = c
a.t = l
assert h.s.y.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.r: A = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

k = A("k")
c = B("c")
g = C("g")
e = D("e")
h = E("h")
l = E("l")
f = C("f")
m = A("m")
a = C("a")

k.p = e
k.r = m
k.y = c
c.z = e
g.t = h
e.z = l
e.y = m
h.s = e
h.q = a
l.s = e
l.q = g
f.t = h
m.p = e
m.r = k
m.y = c
a.t = l
assert h.s.y.r.r.r.txt == "k"