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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.p: E = None
        self.y: F = None
        self.w: E = None
        self.z: B = None
        self.txt = txt

a = A("a")
k = B("k")
f = C("f")
l = D("l")
e = E("e")
c = F("c")
g = D("g")
d = C("d")
n = F("n")
h = B("h")

a.z = c
k.y = a
f.t = h
l.x = e
l.s = f
l.q = a
e.s = a
e.u = c
e.q = h
c.v = e
c.p = e
c.w = e
c.r = f
c.y = n
c.z = h
g.x = e
g.s = f
g.q = a
d.t = k
n.v = e
n.p = e
n.w = e
n.r = d
n.y = c
n.z = k
h.y = a
assert h.y.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: E = None
        self.r: C = None
        self.p: E = None
        self.y: F = None
        self.w: E = None
        self.z: B = None
        self.txt = txt

a = A("a")
k = B("k")
f = C("f")
l = D("l")
e = E("e")
c = F("c")
g = D("g")
d = C("d")
n = F("n")
h = B("h")

a.z = c
k.y = a
f.t = h
l.x = e
l.s = f
l.q = a
e.s = a
e.u = c
e.q = h
c.v = e
c.p = e
c.w = e
c.r = f
c.y = n
c.z = h
g.x = e
g.s = f
g.q = a
d.t = k
n.v = e
n.p = e
n.w = e
n.r = d
n.y = c
n.z = k
h.y = a
assert h.y.z.r.txt == "f"