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

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

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

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

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

b = A("b")
n = B("n")
g = C("g")
e = D("e")
a = E("a")

b.y = a
b.z = e
n.x = g
n.s = a
n.t = e
g.u = n
e.u = a
e.y = a
e.r = g
e.x = b
a.s = g
assert e.x.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
g = C("g")
e = D("e")
a = E("a")

b.y = a
b.z = e
n.x = g
n.s = a
n.t = e
g.u = n
e.u = a
e.y = a
e.r = g
e.x = b
a.s = g
assert e.x.z.r.txt == "g"