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

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

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

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

m = A("m")
i = B("i")
l = C("l")
n = D("n")
b = A("b")
c = C("c")
j = B("j")
k = D("k")
g = D("g")

m.q = g
i.s = k
i.q = b
l.y = b
l.o = m
l.q = c
l.w = c
n.y = b
n.p = l
n.s = l
n.t = j
b.q = g
c.y = b
c.o = b
c.q = l
c.w = l
j.s = g
j.q = m
k.y = b
k.p = l
k.s = l
k.t = j
g.y = m
g.p = c
g.s = c
g.t = j
assert i.s.y.q.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
l = C("l")
n = D("n")
b = A("b")
c = C("c")
j = B("j")
k = D("k")
g = D("g")

m.q = g
i.s = k
i.q = b
l.y = b
l.o = m
l.q = c
l.w = c
n.y = b
n.p = l
n.s = l
n.t = j
b.q = g
c.y = b
c.o = b
c.q = l
c.w = l
j.s = g
j.q = m
k.y = b
k.p = l
k.s = l
k.t = j
g.y = m
g.p = c
g.s = c
g.t = j
assert i.s.y.q.txt == "g"