class A:
    def __init__(self, txt: str):
        self.z: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: G = None
        self.o: D = None
        self.x: D = None
        self.y: C = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: G = None
        self.o: D = None
        self.x: D = None
        self.y: C = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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