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

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

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

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

m = A("m")
g = B("g")
n = C("n")
b = D("b")
a = D("a")
l = A("l")
k = C("k")
f = D("f")
c = B("c")
e = C("e")

m.y = g
m.p = b
g.s = c
n.q = f
n.z = a
n.v = a
n.s = k
b.w = k
b.u = f
b.s = a
a.w = e
a.u = f
a.s = b
l.y = g
l.p = f
k.q = b
k.v = b
k.z = a
k.s = e
f.w = n
f.u = a
f.s = b
c.s = g
e.q = f
e.v = f
e.z = b
e.s = k
assert e.z.w.v.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

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

m = A("m")
g = B("g")
n = C("n")
b = D("b")
a = D("a")
l = A("l")
k = C("k")
f = D("f")
c = B("c")
e = C("e")

m.y = g
m.p = b
g.s = c
n.q = f
n.z = a
n.v = a
n.s = k
b.w = k
b.u = f
b.s = a
a.w = e
a.u = f
a.s = b
l.y = g
l.p = f
k.q = b
k.v = b
k.z = a
k.s = e
f.w = n
f.u = a
f.s = b
c.s = g
e.q = f
e.v = f
e.z = b
e.s = k
assert e.z.w.v.s.s.txt == "b"