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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: F = None
        self.w: F = None
        self.t: F = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.u: F = None
        self.w: F = None
        self.t: F = None
        self.o: F = None
        self.txt = txt

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

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

d.z = f
d.t = f
d.p = f
n.v = f
n.u = f
g.r = i
g.t = n
g.p = b
f.u = d
f.p = b
f.x = n
b.y = f
b.u = i
b.w = i
b.t = i
b.o = i
i.u = b
i.s = b
i.q = g
assert d.p.p.y.u.t.txt == "f"