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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: D = None
        self.p: C = None
        self.v: D = None
        self.z: G = None
        self.x: G = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: G = None
        self.u: F = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.s: B = None
        self.txt = txt

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

j = A("j")
n = B("n")
k = C("k")
h = D("h")
d = E("d")
g = F("g")
c = G("c")
l = B("l")
f = D("f")

j.p = c
j.y = g
j.q = k
n.y = g
k.x = g
k.s = g
k.q = j
k.u = c
h.q = g
h.s = f
h.v = f
h.p = k
h.z = c
h.x = c
h.y = l
d.x = j
d.p = c
d.s = c
d.u = g
g.v = n
g.y = k
g.s = l
c.u = j
c.p = j
c.o = k
c.z = k
l.y = g
f.q = g
f.s = h
f.v = h
f.p = k
f.z = c
f.x = c
f.y = l
assert h.p.q.p.u.p.p.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.y: F = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.s: D = None
        self.p: C = None
        self.v: D = None
        self.z: G = None
        self.x: G = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.p: G = None
        self.u: F = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.y: C = None
        self.s: B = None
        self.txt = txt

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

j = A("j")
n = B("n")
k = C("k")
h = D("h")
d = E("d")
g = F("g")
c = G("c")
l = B("l")
f = D("f")

j.p = c
j.y = g
j.q = k
n.y = g
k.x = g
k.s = g
k.q = j
k.u = c
h.q = g
h.s = f
h.v = f
h.p = k
h.z = c
h.x = c
h.y = l
d.x = j
d.p = c
d.s = c
d.u = g
g.v = n
g.y = k
g.s = l
c.u = j
c.p = j
c.o = k
c.z = k
l.y = g
f.q = g
f.s = h
f.v = h
f.p = k
f.z = c
f.x = c
f.y = l
assert h.p.q.p.u.p.p.q.u.txt == "c"