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

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

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

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

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

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

n.r = l
l.q = m
l.w = k
k.v = b
k.x = e
b.z = k
b.x = k
b.w = m
b.q = e
b.r = n
e.x = c
e.t = m
c.q = b
c.w = k
m.z = k
m.x = k
m.w = b
m.q = e
m.r = n
assert m.r.r.q.z.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

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

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

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

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

n.r = l
l.q = m
l.w = k
k.v = b
k.x = e
b.z = k
b.x = k
b.w = m
b.q = e
b.r = n
e.x = c
e.t = m
c.q = b
c.w = k
m.z = k
m.x = k
m.w = b
m.q = e
m.r = n
assert m.r.r.q.z.v.txt == "b"