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

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: B = None
        self.t: B = None
        self.o: G = None
        self.r: A = None
        self.p: F = None
        self.x: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.txt = txt

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

h.x = e
j.w = h
j.q = i
i.p = c
i.r = l
i.v = j
e.p = b
c.v = e
c.z = j
c.t = j
c.o = b
c.r = h
c.p = l
c.x = l
l.s = j
l.o = i
b.q = h
b.x = i
g.p = l
g.t = c
f.p = l
f.t = c
assert j.q.v.q.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: A = None
        self.q: C = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: B = None
        self.t: B = None
        self.o: G = None
        self.r: A = None
        self.p: F = None
        self.x: F = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.p: F = None
        self.t: E = None
        self.txt = txt

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

h.x = e
j.w = h
j.q = i
i.p = c
i.r = l
i.v = j
e.p = b
c.v = e
c.z = j
c.t = j
c.o = b
c.r = h
c.p = l
c.x = l
l.s = j
l.o = i
b.q = h
b.x = i
g.p = l
g.t = c
f.p = l
f.t = c
assert j.q.v.q.v.w.txt == "h"