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

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: E = None
        self.t: G = None
        self.s: F = None
        self.y: G = None
        self.p: A = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

j = A("j")
d = B("d")
c = C("c")
e = D("e")
a = E("a")
i = F("i")
m = G("m")
l = C("l")

j.w = d
j.p = l
d.o = c
c.r = a
c.w = a
c.o = a
c.t = m
c.y = m
c.s = i
c.p = j
e.s = m
a.z = l
a.p = i
i.s = d
m.p = i
l.r = a
l.w = a
l.o = a
l.t = m
l.y = m
l.s = i
l.p = j
assert m.p.s.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: E = None
        self.w: E = None
        self.t: G = None
        self.s: F = None
        self.y: G = None
        self.p: A = None
        self.o: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.p: F = None
        self.txt = txt

j = A("j")
d = B("d")
c = C("c")
e = D("e")
a = E("a")
i = F("i")
m = G("m")
l = C("l")

j.w = d
j.p = l
d.o = c
c.r = a
c.w = a
c.o = a
c.t = m
c.y = m
c.s = i
c.p = j
e.s = m
a.z = l
a.p = i
i.s = d
m.p = i
l.r = a
l.w = a
l.o = a
l.t = m
l.y = m
l.s = i
l.p = j
assert m.p.s.o.p.txt == "j"