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

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

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

b = A("b")
f = B("f")
e = C("e")
i = C("i")
c = A("c")
n = B("n")
j = C("j")
a = A("a")
g = B("g")

b.y = f
b.o = f
f.u = b
f.w = a
e.p = j
e.o = n
e.w = g
i.p = j
i.o = g
i.w = g
c.y = n
c.o = n
n.u = c
n.w = c
j.p = i
j.o = n
j.w = n
a.y = g
a.o = g
g.u = b
g.w = a
assert f.u.o.w.o.u.o.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.o: B = None
        self.txt = txt

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

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

b = A("b")
f = B("f")
e = C("e")
i = C("i")
c = A("c")
n = B("n")
j = C("j")
a = A("a")
g = B("g")

b.y = f
b.o = f
f.u = b
f.w = a
e.p = j
e.o = n
e.w = g
i.p = j
i.o = g
i.w = g
c.y = n
c.o = n
n.u = c
n.w = c
j.p = i
j.o = n
j.w = n
a.y = g
a.o = g
g.u = b
g.w = a
assert f.u.o.w.o.u.o.w.txt == "a"