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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: B = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: B = None
        self.w: B = None
        self.txt = txt

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

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

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