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

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

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

f = A("f")
b = B("b")
d = C("d")
c = B("c")
i = A("i")
g = C("g")
m = C("m")
l = C("l")
h = C("h")

f.w = m
f.u = g
b.p = d
b.z = f
d.s = l
d.p = h
c.p = g
c.z = f
i.w = d
i.u = m
g.s = m
g.p = h
m.s = h
m.p = h
l.s = g
l.p = g
h.s = g
h.p = l
assert h.s.p.p.p.p.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.u: C = None
        self.txt = txt

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

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

f = A("f")
b = B("b")
d = C("d")
c = B("c")
i = A("i")
g = C("g")
m = C("m")
l = C("l")
h = C("h")

f.w = m
f.u = g
b.p = d
b.z = f
d.s = l
d.p = h
c.p = g
c.z = f
i.w = d
i.u = m
g.s = m
g.p = h
m.s = h
m.p = h
l.s = g
l.p = g
h.s = g
h.p = l
assert h.s.p.p.p.p.s.s.s.txt == "h"