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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: A = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: B = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: E = None
        self.w: E = None
        self.r: E = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: A = None
        self.p: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: B = None
        self.v: A = None
        self.w: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: E = None
        self.w: E = None
        self.r: E = None
        self.txt = txt

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

c.r = n
m.y = c
m.q = c
m.p = k
b.s = i
b.u = k
k.o = b
k.t = m
k.w = m
k.v = e
n.p = k
n.y = i
n.w = i
n.r = i
i.p = k
i.y = n
i.w = n
i.r = n
e.r = n
assert b.u.o.u.o.txt == "b"