class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: A = None
        self.z: C = None
        self.r: C = None
        self.w: B = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: G = None
        self.t: E = None
        self.v: E = None
        self.y: F = None
        self.u: C = None
        self.o: E = None
        self.s: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: A = None
        self.z: C = None
        self.r: C = None
        self.w: B = None
        self.o: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: H = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: F = None
        self.p: G = None
        self.t: E = None
        self.v: E = None
        self.y: F = None
        self.u: C = None
        self.o: E = None
        self.s: F = None
        self.txt = txt

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

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