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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: D = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: F = None
        self.w: D = None
        self.x: D = None
        self.t: C = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: E = None
        self.txt = txt

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

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