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

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.p: A = None
        self.q: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: D = None
        self.s: C = None
        self.q: A = None
        self.txt = txt

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

j.s = f
f.u = j
f.s = j
f.p = j
f.q = j
e.o = j
g.y = f
g.r = b
g.s = n
g.q = j
n.o = j
l.u = j
l.s = j
l.p = j
l.q = j
a.u = j
a.s = j
a.p = j
a.q = j
b.y = l
b.r = g
b.s = n
b.q = j
i.o = j
m.y = f
m.r = b
m.s = i
m.q = j
assert f.q.s.p.s.u.s.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: A = None
        self.s: A = None
        self.p: A = None
        self.q: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: D = None
        self.s: C = None
        self.q: A = None
        self.txt = txt

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

j.s = f
f.u = j
f.s = j
f.p = j
f.q = j
e.o = j
g.y = f
g.r = b
g.s = n
g.q = j
n.o = j
l.u = j
l.s = j
l.p = j
l.q = j
a.u = j
a.s = j
a.p = j
a.q = j
b.y = l
b.r = g
b.s = n
b.q = j
i.o = j
m.y = f
m.r = b
m.s = i
m.q = j
assert f.q.s.p.s.u.s.p.txt == "j"