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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: E = None
        self.u: C = None
        self.t: E = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: A = None
        self.y: C = None
        self.r: B = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

l = A("l")
g = B("g")
b = C("b")
d = D("d")
e = E("e")
f = C("f")
m = B("m")
h = A("h")
n = B("n")

l.o = h
g.p = d
g.r = d
g.o = e
g.t = e
g.u = b
b.x = d
b.p = l
b.y = f
b.r = g
b.s = h
d.t = n
e.y = l
f.x = d
f.p = l
f.s = l
f.y = b
f.r = n
m.p = d
m.r = d
m.o = e
m.t = e
m.u = f
h.o = l
n.p = d
n.r = d
n.o = e
n.t = e
n.u = f
assert h.o.o.o.o.o.o.o.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.o: E = None
        self.u: C = None
        self.t: E = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: A = None
        self.y: C = None
        self.r: B = None
        self.s: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

l = A("l")
g = B("g")
b = C("b")
d = D("d")
e = E("e")
f = C("f")
m = B("m")
h = A("h")
n = B("n")

l.o = h
g.p = d
g.r = d
g.o = e
g.t = e
g.u = b
b.x = d
b.p = l
b.y = f
b.r = g
b.s = h
d.t = n
e.y = l
f.x = d
f.p = l
f.s = l
f.y = b
f.r = n
m.p = d
m.r = d
m.o = e
m.t = e
m.u = f
h.o = l
n.p = d
n.r = d
n.o = e
n.t = e
n.u = f
assert h.o.o.o.o.o.o.o.o.o.txt == "l"