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

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: E = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: A = None
        self.y: E = None
        self.r: C = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.u: A = None
        self.w: F = None
        self.p: C = None
        self.x: D = None
        self.q: A = None
        self.o: B = None
        self.txt = txt

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

h.r = f
h.y = f
l.v = c
l.q = h
g.y = f
g.q = c
g.s = c
g.z = e
c.q = f
c.x = i
c.y = n
i.r = l
f.o = n
f.x = n
f.s = h
f.y = i
f.r = e
n.z = f
n.w = f
n.u = h
n.q = h
n.p = g
n.x = c
n.o = l
e.y = f
e.q = c
e.s = c
e.z = g
assert f.o.z.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: E = None
        self.y: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.s: A = None
        self.y: E = None
        self.r: C = None
        self.x: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.u: A = None
        self.w: F = None
        self.p: C = None
        self.x: D = None
        self.q: A = None
        self.o: B = None
        self.txt = txt

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

h.r = f
h.y = f
l.v = c
l.q = h
g.y = f
g.q = c
g.s = c
g.z = e
c.q = f
c.x = i
c.y = n
i.r = l
f.o = n
f.x = n
f.s = h
f.y = i
f.r = e
n.z = f
n.w = f
n.u = h
n.q = h
n.p = g
n.x = c
n.o = l
e.y = f
e.q = c
e.s = c
e.z = g
assert f.o.z.x.x.txt == "c"