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

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

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

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

e.p = g
e.o = h
g.s = c
g.r = c
g.y = h
f.u = m
f.y = d
b.u = g
b.y = c
c.p = m
c.o = h
d.p = g
d.o = h
i.u = g
i.y = c
h.s = d
h.r = d
h.y = m
k.u = m
k.y = d
m.s = e
m.r = e
m.y = g
assert b.y.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: B = None
        self.txt = txt

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

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

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

e.p = g
e.o = h
g.s = c
g.r = c
g.y = h
f.u = m
f.y = d
b.u = g
b.y = c
c.p = m
c.o = h
d.p = g
d.o = h
i.u = g
i.y = c
h.s = d
h.r = d
h.y = m
k.u = m
k.y = d
m.s = e
m.r = e
m.y = g
assert b.y.o.y.txt == "m"