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

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

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

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

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

n = A("n")
l = B("l")
c = C("c")
j = D("j")
d = E("d")
e = D("e")
f = D("f")
i = E("i")

n.r = c
n.p = e
l.z = d
l.x = c
l.s = n
c.y = j
j.p = f
j.x = f
j.q = i
j.s = l
j.r = e
d.u = n
d.y = n
d.r = i
d.x = i
e.p = j
e.x = j
e.r = j
e.q = i
e.s = l
f.p = j
f.q = i
f.x = e
f.r = e
f.s = l
i.u = n
i.y = n
i.r = d
i.x = d
assert n.r.y.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: D = None
        self.txt = txt

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

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

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

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

n = A("n")
l = B("l")
c = C("c")
j = D("j")
d = E("d")
e = D("e")
f = D("f")
i = E("i")

n.r = c
n.p = e
l.z = d
l.x = c
l.s = n
c.y = j
j.p = f
j.x = f
j.q = i
j.s = l
j.r = e
d.u = n
d.y = n
d.r = i
d.x = i
e.p = j
e.x = j
e.r = j
e.q = i
e.s = l
f.p = j
f.q = i
f.x = e
f.r = e
f.s = l
i.u = n
i.y = n
i.r = d
i.x = d
assert n.r.y.q.y.txt == "n"