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

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

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

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

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

k = A("k")
d = B("d")
a = C("a")
h = D("h")
c = E("c")
i = B("i")
m = A("m")
l = D("l")

k.p = c
k.x = c
k.u = d
k.r = i
d.p = i
d.u = m
d.t = m
d.r = a
a.x = m
h.r = c
c.s = a
c.p = a
c.z = d
i.p = d
i.u = k
i.r = a
i.t = m
m.p = c
m.x = c
m.u = i
m.r = i
l.r = c
assert c.s.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: B = None
        self.x: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

k = A("k")
d = B("d")
a = C("a")
h = D("h")
c = E("c")
i = B("i")
m = A("m")
l = D("l")

k.p = c
k.x = c
k.u = d
k.r = i
d.p = i
d.u = m
d.t = m
d.r = a
a.x = m
h.r = c
c.s = a
c.p = a
c.z = d
i.p = d
i.u = k
i.r = a
i.t = m
m.p = c
m.x = c
m.u = i
m.r = i
l.r = c
assert c.s.x.x.txt == "c"