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

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

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

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

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

j.p = k
l.z = g
l.s = g
l.q = m
l.r = j
m.s = b
g.v = f
g.w = j
g.p = i
i.z = g
i.s = g
i.q = m
i.r = f
b.s = m
f.p = l
k.z = g
k.s = g
k.q = b
k.r = f
assert i.q.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

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

j.p = k
l.z = g
l.s = g
l.q = m
l.r = j
m.s = b
g.v = f
g.w = j
g.p = i
i.z = g
i.s = g
i.q = m
i.r = f
b.s = m
f.p = l
k.z = g
k.s = g
k.q = b
k.r = f
assert i.q.s.s.txt == "m"