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

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

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

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
i = D("i")
j = E("j")
h = F("h")
d = G("d")
e = B("e")

c.o = j
m.y = e
m.z = e
f.w = i
f.t = d
i.v = d
j.u = f
h.r = i
h.q = j
h.o = j
h.s = c
h.u = c
h.y = f
d.u = h
d.x = h
d.s = i
d.t = c
d.q = c
e.y = m
e.z = m
assert h.u.o.u.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

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

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

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

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

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

c = A("c")
m = B("m")
f = C("f")
i = D("i")
j = E("j")
h = F("h")
d = G("d")
e = B("e")

c.o = j
m.y = e
m.z = e
f.w = i
f.t = d
i.v = d
j.u = f
h.r = i
h.q = j
h.o = j
h.s = c
h.u = c
h.y = f
d.u = h
d.x = h
d.s = i
d.t = c
d.q = c
e.y = m
e.z = m
assert h.u.o.u.t.q.txt == "c"