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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.q: B = None
        self.v: C = None
        self.p: E = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: B = None
        self.q: B = None
        self.v: C = None
        self.p: E = None
        self.txt = txt

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

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

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