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

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

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

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

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

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

i.p = d
i.t = d
i.q = j
i.w = j
i.r = h
a.v = h
a.t = h
a.z = h
a.q = i
a.r = j
h.w = d
h.u = a
j.x = a
j.t = f
f.v = a
f.t = a
e.p = f
e.t = f
e.q = j
e.w = j
e.r = h
d.v = a
d.t = a
assert f.t.r.x.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: D = None
        self.r: C = None
        self.w: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

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

i.p = d
i.t = d
i.q = j
i.w = j
i.r = h
a.v = h
a.t = h
a.z = h
a.q = i
a.r = j
h.w = d
h.u = a
j.x = a
j.t = f
f.v = a
f.t = a
e.p = f
e.t = f
e.q = j
e.w = j
e.r = h
d.v = a
d.t = a
assert f.t.r.x.r.x.txt == "a"