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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.v: F = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: C = None
        self.z: D = None
        self.v: F = None
        self.x: B = None
        self.txt = txt

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

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

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

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

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

a.p = l
f.p = h
f.z = g
f.v = d
f.x = k
h.o = a
h.z = a
i.z = l
i.y = g
l.s = d
m.r = f
m.w = i
m.z = h
d.r = k
d.w = g
d.z = h
b.r = k
b.w = g
b.z = h
g.z = l
g.y = i
k.p = h
k.z = i
k.v = m
k.x = f
assert k.z.z.s.txt == "d"