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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.q: D = None
        self.x: A = None
        self.v: B = None
        self.txt = txt

j = A("j")
a = B("a")
m = C("m")
b = D("b")
e = E("e")
g = E("g")
k = A("k")

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: E = None
        self.z: D = None
        self.q: D = None
        self.x: A = None
        self.v: B = None
        self.txt = txt

j = A("j")
a = B("a")
m = C("m")
b = D("b")
e = E("e")
g = E("g")
k = A("k")

j.r = k
j.t = b
j.s = b
j.u = b
j.p = m
a.u = b
a.s = b
a.v = k
a.r = k
a.z = m
m.y = j
b.s = a
e.p = g
e.z = b
e.q = b
e.x = j
e.v = a
g.p = e
g.z = b
g.q = b
g.x = j
g.v = a
k.r = j
k.t = b
k.s = b
k.u = b
k.p = m
assert m.y.p.y.r.txt == "k"