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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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