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

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: F = None
        self.o: E = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: D = None
        self.y: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

a = A("a")
b = B("b")
c = C("c")
m = D("m")
h = E("h")
f = F("f")

a.u = b
a.s = h
a.p = m
b.w = h
c.p = h
c.o = h
c.w = f
c.y = m
m.p = a
h.v = c
h.x = m
h.z = m
h.y = f
h.q = a
f.z = h
f.q = b
f.p = a
assert f.z.y.p.p.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: E = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: E = None
        self.w: F = None
        self.o: E = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.v: C = None
        self.x: D = None
        self.y: F = None
        self.z: D = None
        self.q: A = None
        self.txt = txt

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

a = A("a")
b = B("b")
c = C("c")
m = D("m")
h = E("h")
f = F("f")

a.u = b
a.s = h
a.p = m
b.w = h
c.p = h
c.o = h
c.w = f
c.y = m
m.p = a
h.v = c
h.x = m
h.z = m
h.y = f
h.q = a
f.z = h
f.q = b
f.p = a
assert f.z.y.p.p.p.s.txt == "h"