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

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

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

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

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

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

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

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

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