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

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

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

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

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

d = A("d")
a = B("a")
m = C("m")
f = D("f")
c = E("c")
k = B("k")

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

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

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

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

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

d = A("d")
a = B("a")
m = C("m")
f = D("f")
c = E("c")
k = B("k")

d.r = c
d.v = c
a.w = c
a.t = c
a.x = c
a.r = m
a.v = d
m.r = f
m.u = c
f.q = d
c.v = d
c.s = m
c.r = a
k.w = c
k.t = c
k.x = c
k.r = m
k.v = d
assert m.r.q.v.r.r.u.txt == "c"