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

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

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

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

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

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

m.q = f
g.x = e
f.v = k
f.r = e
e.v = b
e.y = d
e.t = m
e.s = m
d.s = g
d.v = m
d.u = b
k.v = g
k.y = d
k.t = m
k.s = m
b.x = k
assert m.q.v.s.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

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

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

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

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

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

m.q = f
g.x = e
f.v = k
f.r = e
e.v = b
e.y = d
e.t = m
e.s = m
d.s = g
d.v = m
d.u = b
k.v = g
k.y = d
k.t = m
k.s = m
b.x = k
assert m.q.v.s.q.v.txt == "k"