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

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

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

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

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

a = A("a")
i = B("i")
j = C("j")
h = D("h")
f = E("f")
b = A("b")
d = D("d")

a.o = d
a.w = d
a.r = b
a.q = j
a.t = j
i.r = h
i.o = j
i.w = d
j.y = h
j.z = d
j.t = d
j.o = b
h.t = f
h.s = j
h.z = a
f.y = b
f.p = i
b.o = h
b.r = a
b.q = j
b.t = j
b.w = d
d.t = f
d.s = j
d.z = b
assert d.t.p.o.z.t.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.r: A = None
        self.q: C = None
        self.w: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

a = A("a")
i = B("i")
j = C("j")
h = D("h")
f = E("f")
b = A("b")
d = D("d")

a.o = d
a.w = d
a.r = b
a.q = j
a.t = j
i.r = h
i.o = j
i.w = d
j.y = h
j.z = d
j.t = d
j.o = b
h.t = f
h.s = j
h.z = a
f.y = b
f.p = i
b.o = h
b.r = a
b.q = j
b.t = j
b.w = d
d.t = f
d.s = j
d.z = b
assert d.t.p.o.z.t.txt == "f"