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

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

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

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

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

i = A("i")
h = B("h")
d = C("d")
f = D("f")
e = E("e")
m = E("m")
n = D("n")

i.r = h
i.w = h
i.t = d
i.q = d
h.w = e
h.s = f
h.t = m
h.r = d
h.x = i
d.v = n
f.y = d
f.r = d
f.x = n
f.w = n
e.p = f
e.o = d
e.y = m
m.p = f
m.o = d
m.y = e
n.y = d
n.r = d
n.x = f
n.w = f
assert d.v.x.r.v.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.t: C = None
        self.q: C = None
        self.w: B = None
        self.txt = txt

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

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

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

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

i = A("i")
h = B("h")
d = C("d")
f = D("f")
e = E("e")
m = E("m")
n = D("n")

i.r = h
i.w = h
i.t = d
i.q = d
h.w = e
h.s = f
h.t = m
h.r = d
h.x = i
d.v = n
f.y = d
f.r = d
f.x = n
f.w = n
e.p = f
e.o = d
e.y = m
m.p = f
m.o = d
m.y = e
n.y = d
n.r = d
n.x = f
n.w = f
assert d.v.x.r.v.y.v.txt == "n"