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

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

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

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

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

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

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

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

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

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

l.q = m
l.s = j
j.s = e
j.t = l
j.q = b
i.o = j
i.y = j
i.p = b
m.v = e
b.o = a
b.p = i
b.y = j
e.q = g
e.s = j
g.v = l
a.s = l
a.t = l
a.q = b
assert b.o.s.q.txt == "m"