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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: H = None
        self.w: E = None
        self.v: C = None
        self.y: F = None
        self.s: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.q: H = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.q: F = None
        self.x: H = None
        self.w: E = None
        self.v: C = None
        self.y: F = None
        self.s: C = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: B = None
        self.q: H = None
        self.o: E = None
        self.z: D = None
        self.txt = txt

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

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

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

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