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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
a = C("a")
k = D("k")
n = C("n")
j = D("j")
i = D("i")
d = A("d")
g = B("g")

b.y = a
b.x = a
b.r = n
m.o = g
m.p = g
a.w = n
a.q = n
a.v = n
a.s = n
k.v = a
n.w = a
n.q = a
n.v = a
n.s = a
j.v = n
i.v = n
d.y = a
d.r = a
d.x = n
g.o = m
g.p = m
assert j.v.q.w.q.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.r: C = None
        self.x: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
a = C("a")
k = D("k")
n = C("n")
j = D("j")
i = D("i")
d = A("d")
g = B("g")

b.y = a
b.x = a
b.r = n
m.o = g
m.p = g
a.w = n
a.q = n
a.v = n
a.s = n
k.v = a
n.w = a
n.q = a
n.v = a
n.s = a
j.v = n
i.v = n
d.y = a
d.r = a
d.x = n
g.o = m
g.p = m
assert j.v.q.w.q.v.s.s.txt == "n"