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

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.o: B = None
        self.r: F = None
        self.z: B = None
        self.txt = txt

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

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

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

m.z = g
a.o = g
i.x = f
i.t = d
h.p = g
h.s = f
h.o = a
h.z = a
h.r = d
g.t = f
d.w = g
d.x = g
f.p = g
f.s = h
f.o = a
f.z = a
f.r = d
assert a.o.t.p.t.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.s: D = None
        self.o: B = None
        self.r: F = None
        self.z: B = None
        self.txt = txt

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

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

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

m.z = g
a.o = g
i.x = f
i.t = d
h.p = g
h.s = f
h.o = a
h.z = a
h.r = d
g.t = f
d.w = g
d.x = g
f.p = g
f.s = h
f.o = a
f.z = a
f.r = d
assert a.o.t.p.t.s.s.s.txt == "h"