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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.u: A = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
m = C("m")
b = D("b")
a = E("a")
n = E("n")
d = C("d")

f.p = b
e.t = n
e.s = d
e.u = f
e.p = a
e.r = b
m.p = a
m.r = n
m.w = e
m.o = f
m.q = d
b.r = e
b.v = d
a.u = e
a.y = e
a.z = b
a.w = b
a.p = b
n.u = e
n.y = e
n.z = b
n.w = b
n.p = b
d.p = a
d.r = a
d.w = e
d.o = f
d.q = m
assert e.t.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.s: C = None
        self.u: A = None
        self.p: E = None
        self.r: D = None
        self.txt = txt

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

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

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

f = A("f")
e = B("e")
m = C("m")
b = D("b")
a = E("a")
n = E("n")
d = C("d")

f.p = b
e.t = n
e.s = d
e.u = f
e.p = a
e.r = b
m.p = a
m.r = n
m.w = e
m.o = f
m.q = d
b.r = e
b.v = d
a.u = e
a.y = e
a.z = b
a.w = b
a.p = b
n.u = e
n.y = e
n.z = b
n.w = b
n.p = b
d.p = a
d.r = a
d.w = e
d.o = f
d.q = m
assert e.t.u.u.txt == "f"