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

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

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

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

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

e = A("e")
j = B("j")
h = C("h")
d = D("d")
l = E("l")
f = E("f")

e.o = f
e.p = j
e.r = j
e.w = l
j.z = e
h.o = l
h.q = d
h.t = e
d.x = h
d.r = f
l.t = f
l.x = e
f.t = l
f.x = e
assert f.x.w.x.r.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.p: B = None
        self.w: E = None
        self.r: B = None
        self.txt = txt

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

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

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

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

e = A("e")
j = B("j")
h = C("h")
d = D("d")
l = E("l")
f = E("f")

e.o = f
e.p = j
e.r = j
e.w = l
j.z = e
h.o = l
h.q = d
h.t = e
d.x = h
d.r = f
l.t = f
l.x = e
f.t = l
f.x = e
assert f.x.w.x.r.z.o.txt == "f"