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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: E = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.p: E = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: D = None
        self.txt = txt

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

f.t = l
f.y = b
d.u = m
d.x = m
d.o = g
d.s = g
d.t = l
m.u = f
m.w = f
m.t = g
m.x = b
l.t = f
l.x = f
l.p = b
b.v = m
b.r = l
g.u = m
g.x = m
g.o = d
g.s = d
g.t = l
assert l.p.v.t.o.t.txt == "l"