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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: G = None
        self.v: G = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.u: G = None
        self.v: G = None
        self.t: D = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: A = None
        self.txt = txt

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

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