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

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

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

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

j = A("j")
c = B("c")
e = C("e")
g = D("g")
l = C("l")
m = A("m")
b = A("b")

j.s = m
j.z = l
c.w = j
c.q = l
e.v = c
e.r = m
e.u = m
g.q = l
g.t = l
g.o = b
l.v = c
l.r = m
l.u = b
m.s = j
m.z = e
b.s = j
b.z = e
assert l.r.s.s.s.z.r.z.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: C = None
        self.txt = txt

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

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

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

j = A("j")
c = B("c")
e = C("e")
g = D("g")
l = C("l")
m = A("m")
b = A("b")

j.s = m
j.z = l
c.w = j
c.q = l
e.v = c
e.r = m
e.u = m
g.q = l
g.t = l
g.o = b
l.v = c
l.r = m
l.u = b
m.s = j
m.z = e
b.s = j
b.z = e
assert l.r.s.s.s.z.r.z.txt == "e"