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

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

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

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

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

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

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

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

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

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

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

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

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

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

g.o = d
g.y = h
g.s = h
g.w = e
h.p = g
h.s = l
d.q = e
e.z = m
k.v = d
k.w = g
k.p = e
k.x = m
l.u = g
l.x = g
l.w = h
l.o = h
m.v = d
m.w = g
m.p = e
m.x = k
assert h.p.s.s.w.p.s.s.txt == "l"