class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

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

a = A("a")
n = B("n")
h = C("h")
l = D("l")
b = E("b")
j = F("j")
f = G("f")
c = G("c")

a.y = b
a.v = c
n.y = b
n.p = a
n.u = l
n.z = h
h.x = b
l.v = n
l.s = n
l.z = a
l.q = j
l.t = j
l.w = c
b.q = h
b.s = f
b.z = c
b.u = c
b.o = a
b.t = l
j.o = f
j.r = b
j.z = l
f.v = h
f.q = c
c.v = h
c.q = f
assert c.q.q.q.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.v: G = None
        self.txt = txt

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

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

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

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

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

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

a = A("a")
n = B("n")
h = C("h")
l = D("l")
b = E("b")
j = F("j")
f = G("f")
c = G("c")

a.y = b
a.v = c
n.y = b
n.p = a
n.u = l
n.z = h
h.x = b
l.v = n
l.s = n
l.z = a
l.q = j
l.t = j
l.w = c
b.q = h
b.s = f
b.z = c
b.u = c
b.o = a
b.t = l
j.o = f
j.r = b
j.z = l
f.v = h
f.q = c
c.v = h
c.q = f
assert c.q.q.q.q.q.q.txt == "c"