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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
g = C("g")
b = D("b")
j = E("j")

n.s = g
n.t = g
n.z = b
n.y = j
n.w = j
m.w = n
g.u = n
g.t = j
b.o = n
b.r = g
j.u = b
assert b.o.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: D = None
        self.t: C = None
        self.y: E = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.txt = txt

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

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

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

n = A("n")
m = B("m")
g = C("g")
b = D("b")
j = E("j")

n.s = g
n.t = g
n.z = b
n.y = j
n.w = j
m.w = n
g.u = n
g.t = j
b.o = n
b.r = g
j.u = b
assert b.o.y.u.txt == "b"