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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: D = None
        self.s: F = None
        self.u: F = None
        self.txt = txt

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

g = A("g")
a = B("a")
h = C("h")
d = D("d")
n = E("n")
b = F("b")

g.p = a
g.o = d
g.w = d
g.z = d
g.s = n
g.q = b
a.s = h
a.q = b
h.s = d
d.q = a
d.z = h
n.o = g
n.y = d
n.s = b
n.u = b
b.u = n
b.o = a
assert b.o.s.s.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.o: D = None
        self.s: E = None
        self.q: F = None
        self.w: D = None
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: D = None
        self.s: F = None
        self.u: F = None
        self.txt = txt

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

g = A("g")
a = B("a")
h = C("h")
d = D("d")
n = E("n")
b = F("b")

g.p = a
g.o = d
g.w = d
g.z = d
g.s = n
g.q = b
a.s = h
a.q = b
h.s = d
d.q = a
d.z = h
n.o = g
n.y = d
n.s = b
n.u = b
b.u = n
b.o = a
assert b.o.s.s.q.txt == "a"