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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: F = None
        self.w: D = None
        self.q: B = None
        self.t: D = None
        self.u: F = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.v: H = None
        self.t: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.z: F = None
        self.w: D = None
        self.q: B = None
        self.t: D = None
        self.u: F = None
        self.r: D = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.v: H = None
        self.t: D = None
        self.txt = txt

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

class H:
    def __init__(self, txt: str):
        self.w: B = None
        self.txt = txt

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

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