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

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: C = None
        self.t: E = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

b.z = n
d.x = c
d.p = i
d.t = a
d.w = n
i.u = b
i.s = b
i.p = b
i.r = c
i.w = n
i.x = a
c.q = n
c.w = i
c.s = d
a.z = d
a.y = n
n.y = i
n.t = a
n.z = c
assert a.z.p.u.z.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.x: D = None
        self.p: C = None
        self.t: E = None
        self.w: F = None
        self.txt = txt

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

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

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

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

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

b.z = n
d.x = c
d.p = i
d.t = a
d.w = n
i.u = b
i.s = b
i.p = b
i.r = c
i.w = n
i.x = a
c.q = n
c.w = i
c.s = d
a.z = d
a.y = n
n.y = i
n.t = a
n.z = c
assert a.z.p.u.z.z.txt == "c"