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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: G = None
        self.o: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: C = None
        self.s: C = None
        self.p: D = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: G = None
        self.o: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.t: B = None
        self.z: C = None
        self.s: C = None
        self.p: D = None
        self.o: G = None
        self.x: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.q: A = None
        self.txt = txt

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

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