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

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.p: C = None
        self.y: B = 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.x: D = None
        self.s: E = None
        self.txt = txt

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

m.p = k
m.w = e
a.p = m
a.w = e
a.z = h
k.y = m
k.x = m
k.s = l
e.o = m
e.w = f
e.p = k
e.y = a
f.s = h
h.x = l
h.s = f
l.o = m
l.w = f
l.p = k
l.y = a
d.x = e
d.s = f
assert h.s.s.s.s.s.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.w: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.w: E = None
        self.p: C = None
        self.y: B = 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.x: D = None
        self.s: E = None
        self.txt = txt

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

m.p = k
m.w = e
a.p = m
a.w = e
a.z = h
k.y = m
k.x = m
k.s = l
e.o = m
e.w = f
e.p = k
e.y = a
f.s = h
h.x = l
h.s = f
l.o = m
l.w = f
l.p = k
l.y = a
d.x = e
d.s = f
assert h.s.s.s.s.s.s.x.txt == "l"