class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.t: B = None
        self.q: B = None
        self.s: C = None
        self.x: B = None
        self.txt = txt

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

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

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

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

f = A("f")
d = B("d")
h = C("h")
c = D("c")
i = E("i")

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

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

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

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

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

f = A("f")
d = B("d")
h = C("h")
c = D("c")
i = E("i")

f.v = h
f.s = h
f.t = d
f.q = d
f.x = d
d.t = f
d.v = f
h.v = c
h.w = c
c.q = h
c.p = i
i.s = h
i.v = f
i.p = c
assert i.p.p.s.w.q.txt == "h"