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

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

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

b = A("b")
d = B("d")
g = C("g")
c = B("c")
n = A("n")
a = C("a")
k = C("k")
l = A("l")
i = A("i")

b.w = n
b.p = n
b.z = k
d.y = g
d.s = l
g.t = b
g.s = a
g.o = a
c.y = g
c.s = b
n.w = l
n.z = g
n.p = i
a.t = i
a.s = k
a.o = k
k.t = b
k.s = g
k.o = g
l.w = i
l.p = i
l.z = a
i.w = b
i.z = k
i.p = l
assert c.s.z.t.w.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.w: A = None
        self.z: C = None
        self.p: A = None
        self.txt = txt

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

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

b = A("b")
d = B("d")
g = C("g")
c = B("c")
n = A("n")
a = C("a")
k = C("k")
l = A("l")
i = A("i")

b.w = n
b.p = n
b.z = k
d.y = g
d.s = l
g.t = b
g.s = a
g.o = a
c.y = g
c.s = b
n.w = l
n.z = g
n.p = i
a.t = i
a.s = k
a.o = k
k.t = b
k.s = g
k.o = g
l.w = i
l.p = i
l.z = a
i.w = b
i.z = k
i.p = l
assert c.s.z.t.w.w.p.w.txt == "b"