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

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.o: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

i = A("i")
f = B("f")
m = C("m")
b = D("b")
k = E("k")
e = F("e")
g = E("g")
a = C("a")
l = E("l")

i.u = a
f.s = e
f.u = i
m.o = b
m.u = b
m.s = f
m.y = l
b.u = i
b.x = f
b.o = e
k.o = a
k.u = e
e.o = l
g.o = a
g.u = e
a.o = b
a.u = b
a.s = f
a.y = g
l.o = m
l.u = e
assert l.u.o.o.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: A = None
        self.x: B = None
        self.o: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

i = A("i")
f = B("f")
m = C("m")
b = D("b")
k = E("k")
e = F("e")
g = E("g")
a = C("a")
l = E("l")

i.u = a
f.s = e
f.u = i
m.o = b
m.u = b
m.s = f
m.y = l
b.u = i
b.x = f
b.o = e
k.o = a
k.u = e
e.o = l
g.o = a
g.u = e
a.o = b
a.u = b
a.s = f
a.y = g
l.o = m
l.u = e
assert l.u.o.o.y.o.txt == "m"