class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.x: D = None
        self.p: C = None
        self.r: G = None
        self.w: B = None
        self.txt = txt

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

d.t = a
d.y = c
d.x = c
d.r = m
d.w = m
c.t = l
c.x = l
c.v = m
g.x = d
m.v = l
m.z = c
j.y = a
j.z = m
a.r = g
a.u = m
f.p = a
f.v = m
f.z = j
l.q = g
l.p = g
l.y = d
l.x = m
l.r = f
l.w = c
assert j.z.v.q.x.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.t: F = None
        self.y: B = None
        self.x: B = None
        self.r: D = None
        self.w: D = None
        self.txt = txt

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

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

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.q: C = None
        self.y: A = None
        self.x: D = None
        self.p: C = None
        self.r: G = None
        self.w: B = None
        self.txt = txt

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

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