class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.q: E = None
        self.p: E = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: D = None
        self.v: C = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.q: E = None
        self.x: B = None
        self.s: E = None
        self.w: C = None
        self.txt = txt

a = A("a")
h = B("h")
c = C("c")
d = D("d")
b = E("b")
i = F("i")
m = G("m")

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

class B:
    def __init__(self, txt: str):
        self.t: C = None
        self.o: D = None
        self.v: C = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.p: E = None
        self.u: C = None
        self.q: E = None
        self.x: B = None
        self.s: E = None
        self.w: C = None
        self.txt = txt

a = A("a")
h = B("h")
c = C("c")
d = D("d")
b = E("b")
i = F("i")
m = G("m")

a.y = c
a.q = b
a.p = b
a.x = d
h.t = c
h.v = c
h.o = d
h.u = m
c.t = d
d.q = h
d.r = m
b.z = c
b.x = c
b.q = m
b.w = d
b.p = d
b.u = a
i.w = b
m.p = b
m.q = b
m.s = b
m.u = c
m.w = c
m.x = h
assert h.o.q.u.w.t.r.u.txt == "c"