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

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

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: B = None
        self.z: D = None
        self.txt = txt

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

l = A("l")
g = B("g")
k = C("k")
m = D("m")
h = E("h")
f = D("f")
c = A("c")

l.o = c
g.u = l
g.t = h
k.x = g
k.p = g
m.w = k
m.v = g
m.z = f
h.w = g
h.u = g
h.y = k
f.w = k
f.v = g
f.z = m
c.o = l
assert l.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.u: A = None
        self.t: E = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.v: B = None
        self.z: D = None
        self.txt = txt

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

l = A("l")
g = B("g")
k = C("k")
m = D("m")
h = E("h")
f = D("f")
c = A("c")

l.o = c
g.u = l
g.t = h
k.x = g
k.p = g
m.w = k
m.v = g
m.z = f
h.w = g
h.u = g
h.y = k
f.w = k
f.v = g
f.z = m
c.o = l
assert l.o.o.o.o.o.txt == "c"