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

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

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

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

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

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

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

i.z = d
i.w = g
g.z = f
n.r = g
n.z = g
n.s = f
n.t = d
h.y = n
f.o = i
d.o = g
d.p = g
d.y = g
assert h.y.z.z.o.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

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

i.z = d
i.w = g
g.z = f
n.r = g
n.z = g
n.s = f
n.t = d
h.y = n
f.o = i
d.o = g
d.p = g
d.y = g
assert h.y.z.z.o.z.p.txt == "g"