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

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

i.x = n
i.v = e
i.s = m
i.p = h
i.r = h
f.v = m
f.t = m
f.x = e
h.y = f
m.q = h
n.s = i
n.z = e
e.y = m
e.p = n
e.u = h
assert h.y.t.q.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.v: F = None
        self.s: D = None
        self.p: C = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.z: F = None
        self.txt = txt

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

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

i.x = n
i.v = e
i.s = m
i.p = h
i.r = h
f.v = m
f.t = m
f.x = e
h.y = f
m.q = h
n.s = i
n.z = e
e.y = m
e.p = n
e.u = h
assert h.y.t.q.y.x.txt == "e"