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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: E = None
        self.txt = txt

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

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

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

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

k.x = b
k.w = n
g.w = b
g.o = n
b.r = g
b.u = g
b.o = d
e.y = b
n.w = g
d.x = b
d.w = n
assert b.u.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: E = None
        self.txt = txt

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

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

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

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

k.x = b
k.w = n
g.w = b
g.o = n
b.r = g
b.u = g
b.o = d
e.y = b
n.w = g
d.x = b
d.w = n
assert b.u.o.w.txt == "g"