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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: B = None
        self.z: H = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: H = None
        self.txt = txt

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: G = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: C = None
        self.o: B = None
        self.z: H = None
        self.q: B = None
        self.x: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: G = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.u: C = None
        self.z: H = None
        self.txt = txt

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

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

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