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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.t: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

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

a = A("a")
b = B("b")
n = C("n")
m = D("m")
c = E("c")
k = A("k")
e = B("e")

a.w = c
b.s = c
b.v = c
b.t = e
b.x = e
b.r = k
n.o = c
m.t = c
m.v = c
m.s = b
m.u = k
c.u = b
c.v = m
k.w = c
e.s = c
e.v = c
e.t = b
e.x = b
e.r = a
assert a.w.u.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.v: E = None
        self.t: B = None
        self.r: A = None
        self.x: B = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.v: E = None
        self.u: A = None
        self.txt = txt

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

a = A("a")
b = B("b")
n = C("n")
m = D("m")
c = E("c")
k = A("k")
e = B("e")

a.w = c
b.s = c
b.v = c
b.t = e
b.x = e
b.r = k
n.o = c
m.t = c
m.v = c
m.s = b
m.u = k
c.u = b
c.v = m
k.w = c
e.s = c
e.v = c
e.t = b
e.x = b
e.r = a
assert a.w.u.r.w.txt == "c"