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

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

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

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

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

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

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

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

d.u = i
d.o = l
d.y = l
c.p = i
c.w = g
c.s = l
l.u = d
l.q = i
g.p = i
g.w = n
g.s = l
n.p = d
n.w = g
n.s = l
a.u = i
a.o = l
a.y = l
i.u = d
i.o = l
i.y = l
assert i.u.o.u.y.txt == "l"