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

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

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

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

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

h = A("h")
l = B("l")
f = C("f")
a = D("a")
i = E("i")

h.r = f
h.q = l
h.o = l
h.t = a
l.p = h
l.r = f
l.u = f
l.v = a
l.x = a
f.v = a
f.w = i
a.w = f
a.r = i
a.t = i
i.r = f
assert f.w.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: B = None
        self.t: D = None
        self.o: B = None
        self.txt = txt

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

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

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

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

h = A("h")
l = B("l")
f = C("f")
a = D("a")
i = E("i")

h.r = f
h.q = l
h.o = l
h.t = a
l.p = h
l.r = f
l.u = f
l.v = a
l.x = a
f.v = a
f.w = i
a.w = f
a.r = i
a.t = i
i.r = f
assert f.w.r.v.txt == "a"