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

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

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

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

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

e = A("e")
k = B("k")
i = C("i")
a = D("a")
d = E("d")
f = E("f")
m = B("m")
h = C("h")

e.x = i
e.p = i
e.s = d
e.q = a
k.y = a
k.u = e
k.r = h
i.x = e
i.z = f
a.x = d
a.u = d
a.r = e
a.y = h
d.p = i
d.q = f
d.y = f
d.z = a
f.p = h
f.q = d
f.y = d
f.z = a
m.y = a
m.u = e
m.r = h
h.x = e
h.z = f
assert k.y.r.q.y.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.s: E = None
        self.p: C = None
        self.q: D = None
        self.txt = txt

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

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

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

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

e = A("e")
k = B("k")
i = C("i")
a = D("a")
d = E("d")
f = E("f")
m = B("m")
h = C("h")

e.x = i
e.p = i
e.s = d
e.q = a
k.y = a
k.u = e
k.r = h
i.x = e
i.z = f
a.x = d
a.u = d
a.r = e
a.y = h
d.p = i
d.q = f
d.y = f
d.z = a
f.p = h
f.q = d
f.y = d
f.z = a
m.y = a
m.u = e
m.r = h
h.x = e
h.z = f
assert k.y.r.q.y.x.q.txt == "a"