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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

f.p = m
f.o = g
g.z = b
g.q = e
g.y = e
g.v = d
d.y = b
d.v = b
d.p = b
d.s = l
l.s = m
l.o = m
b.w = g
b.t = e
m.p = f
m.o = e
e.z = b
e.q = g
e.y = g
e.v = d
assert f.o.z.w.z.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.o: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.q: B = None
        self.v: C = None
        self.y: B = None
        self.txt = txt

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

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

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

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

f.p = m
f.o = g
g.z = b
g.q = e
g.y = e
g.v = d
d.y = b
d.v = b
d.p = b
d.s = l
l.s = m
l.o = m
b.w = g
b.t = e
m.p = f
m.o = e
e.z = b
e.q = g
e.y = g
e.v = d
assert f.o.z.w.z.t.z.txt == "b"