class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

h = A("h")
g = B("g")
n = C("n")
c = D("c")
m = E("m")
l = F("l")

h.y = g
h.t = g
h.q = m
g.t = n
n.r = l
n.z = l
n.y = m
n.v = c
c.z = g
c.p = g
c.o = g
c.y = g
c.s = h
m.v = c
m.x = g
m.o = h
l.s = n
l.u = h
l.z = g
l.r = m
l.p = c
assert m.v.s.q.v.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: B = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

h = A("h")
g = B("g")
n = C("n")
c = D("c")
m = E("m")
l = F("l")

h.y = g
h.t = g
h.q = m
g.t = n
n.r = l
n.z = l
n.y = m
n.v = c
c.z = g
c.p = g
c.o = g
c.y = g
c.s = h
m.v = c
m.x = g
m.o = h
l.s = n
l.u = h
l.z = g
l.r = m
l.p = c
assert m.v.s.q.v.s.t.txt == "g"