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

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.u: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: C = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

i = A("i")
d = B("d")
n = C("n")
g = D("g")
f = E("f")
c = F("c")

i.z = g
i.q = c
i.u = d
d.z = g
d.o = g
d.u = f
n.p = g
g.z = f
g.w = c
f.v = n
f.o = d
f.u = i
f.t = g
c.t = d
c.w = n
c.v = n
c.s = f
assert n.p.z.v.p.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.q: F = None
        self.u: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: E = None
        self.o: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.o: B = None
        self.u: A = None
        self.t: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.w: C = None
        self.s: E = None
        self.v: C = None
        self.txt = txt

i = A("i")
d = B("d")
n = C("n")
g = D("g")
f = E("f")
c = F("c")

i.z = g
i.q = c
i.u = d
d.z = g
d.o = g
d.u = f
n.p = g
g.z = f
g.w = c
f.v = n
f.o = d
f.u = i
f.t = g
c.t = d
c.w = n
c.v = n
c.s = f
assert n.p.z.v.p.z.o.txt == "d"