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

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

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

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

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

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

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

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

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

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

m.s = f
m.u = k
m.q = k
m.w = a
j.p = e
j.q = g
j.r = k
e.s = a
c.v = a
c.s = a
c.o = k
c.t = j
k.s = c
f.s = m
f.u = k
f.q = k
f.w = a
b.p = e
b.q = g
b.r = k
g.s = a
a.v = c
a.s = c
a.o = k
a.t = j
assert j.r.s.o.s.txt == "c"