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

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

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

j = A("j")
c = B("c")
f = C("f")
i = C("i")
d = B("d")
b = A("b")
g = C("g")

j.o = d
j.y = g
c.u = d
c.y = d
f.o = d
f.s = d
i.o = c
i.s = c
d.u = c
d.y = c
b.o = c
b.y = g
g.o = c
g.s = c
assert g.s.u.y.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.txt = txt

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

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

j = A("j")
c = B("c")
f = C("f")
i = C("i")
d = B("d")
b = A("b")
g = C("g")

j.o = d
j.y = g
c.u = d
c.y = d
f.o = d
f.s = d
i.o = c
i.s = c
d.u = c
d.y = c
b.o = c
b.y = g
g.o = c
g.s = c
assert g.s.u.y.u.u.txt == "c"