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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

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

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