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

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.s: B = None
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.z: C = None
        self.s: B = None
        self.v: E = None
        self.q: E = None
        self.txt = txt

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

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

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

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

f.o = l
k.z = e
k.s = e
k.o = f
k.w = g
k.p = l
k.q = n
n.r = k
g.r = l
g.z = n
g.s = k
g.v = m
g.q = m
m.u = f
m.v = l
m.o = l
m.q = l
m.x = e
c.z = e
c.x = e
c.t = f
c.p = g
l.r = k
e.r = k
assert g.z.r.o.o.r.txt == "k"