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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: D = None
        self.t: B = None
        self.z: D = None
        self.txt = txt

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

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

h.s = g
h.o = n
h.t = d
n.v = d
n.q = l
n.o = e
e.v = h
d.x = n
d.q = g
d.w = h
d.o = l
l.x = g
l.w = d
l.z = d
l.t = n
g.w = h
g.s = h
g.r = e
g.v = e
g.p = d
g.z = n
assert g.s.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.o: B = None
        self.t: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: D = None
        self.t: B = None
        self.z: D = None
        self.txt = txt

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

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

h.s = g
h.o = n
h.t = d
n.v = d
n.q = l
n.o = e
e.v = h
d.x = n
d.q = g
d.w = h
d.o = l
l.x = g
l.w = d
l.z = d
l.t = n
g.w = h
g.s = h
g.r = e
g.v = e
g.p = d
g.z = n
assert g.s.t.q.txt == "g"