class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

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

c = A("c")
i = B("i")
a = C("a")
h = D("h")
e = E("e")
d = F("d")
n = D("n")

c.x = e
i.r = c
a.z = h
h.t = a
h.y = a
h.p = c
h.v = n
e.w = c
e.z = i
d.x = h
d.u = n
d.p = e
n.t = a
n.y = a
n.p = c
n.v = h
assert i.r.x.z.r.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.txt = txt

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

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

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

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

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

c = A("c")
i = B("i")
a = C("a")
h = D("h")
e = E("e")
d = F("d")
n = D("n")

c.x = e
i.r = c
a.z = h
h.t = a
h.y = a
h.p = c
h.v = n
e.w = c
e.z = i
d.x = h
d.u = n
d.p = e
n.t = a
n.y = a
n.p = c
n.v = h
assert i.r.x.z.r.x.txt == "e"