class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.o: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

e = A("e")
b = B("b")
g = C("g")
k = D("k")
f = E("f")
h = F("h")

e.p = b
e.t = k
e.o = k
e.z = f
b.y = g
b.s = g
b.u = k
b.r = k
b.o = e
g.x = f
k.v = f
k.y = e
f.w = g
f.x = g
f.o = h
f.v = k
f.s = e
h.y = k
assert f.s.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: D = None
        self.o: D = None
        self.z: E = None
        self.txt = txt

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

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

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

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

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

e = A("e")
b = B("b")
g = C("g")
k = D("k")
f = E("f")
h = F("h")

e.p = b
e.t = k
e.o = k
e.z = f
b.y = g
b.s = g
b.u = k
b.r = k
b.o = e
g.x = f
k.v = f
k.y = e
f.w = g
f.x = g
f.o = h
f.v = k
f.s = e
h.y = k
assert f.s.p.s.txt == "g"