class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.w: E = None
        self.o: C = None
        self.z: F = None
        self.u: E = None
        self.r: A = None
        self.v: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.y: A = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
g = C("g")
j = D("j")
f = E("f")
b = F("b")
c = G("c")

n.t = g
e.p = j
e.z = g
e.q = b
e.t = n
g.u = n
g.t = c
j.t = c
j.w = f
j.u = f
j.o = g
j.z = b
j.r = n
j.v = e
f.o = n
f.r = e
b.p = g
b.s = j
b.y = n
b.u = n
c.q = f
c.v = n
assert f.o.t.t.q.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: G = None
        self.w: E = None
        self.o: C = None
        self.z: F = None
        self.u: E = None
        self.r: A = None
        self.v: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.s: D = None
        self.y: A = None
        self.u: A = None
        self.txt = txt

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

n = A("n")
e = B("e")
g = C("g")
j = D("j")
f = E("f")
b = F("b")
c = G("c")

n.t = g
e.p = j
e.z = g
e.q = b
e.t = n
g.u = n
g.t = c
j.t = c
j.w = f
j.u = f
j.o = g
j.z = b
j.r = n
j.v = e
f.o = n
f.r = e
b.p = g
b.s = j
b.y = n
b.u = n
c.q = f
c.v = n
assert f.o.t.t.q.o.t.txt == "g"