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

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.w: C = None
        self.r: B = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: D = None
        self.w: D = None
        self.r: C = None
        self.y: B = None
        self.txt = txt

h = A("h")
i = B("i")
g = C("g")
f = D("f")
c = E("c")
a = F("a")

h.s = a
i.p = h
i.q = h
i.v = h
g.v = h
g.r = f
g.y = i
f.t = h
f.v = i
f.o = g
c.z = h
c.s = h
c.w = g
c.r = i
c.q = i
c.x = i
a.p = g
a.r = g
a.u = f
a.w = f
a.y = i
assert i.q.s.y.p.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: A = None
        self.w: C = None
        self.r: B = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: D = None
        self.w: D = None
        self.r: C = None
        self.y: B = None
        self.txt = txt

h = A("h")
i = B("i")
g = C("g")
f = D("f")
c = E("c")
a = F("a")

h.s = a
i.p = h
i.q = h
i.v = h
g.v = h
g.r = f
g.y = i
f.t = h
f.v = i
f.o = g
c.z = h
c.s = h
c.w = g
c.r = i
c.q = i
c.x = i
a.p = g
a.r = g
a.u = f
a.w = f
a.y = i
assert i.q.s.y.p.s.txt == "a"