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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: H = None
        self.w: A = None
        self.v: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: B = None
        self.o: E = None
        self.z: G = None
        self.p: E = None
        self.s: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: F = None
        self.txt = txt

a = A("a")
b = B("b")
m = C("m")
d = D("d")
e = E("e")
f = F("f")
c = G("c")
j = H("j")
i = G("i")

a.u = b
a.s = i
b.q = e
m.w = f
m.u = b
d.y = f
d.s = j
d.w = a
d.v = b
e.v = a
e.p = i
f.y = c
c.u = i
c.z = i
c.r = b
c.o = e
c.p = e
c.s = j
j.q = b
j.y = f
i.u = c
i.z = c
i.r = b
i.o = e
i.p = e
i.s = j
assert a.s.p.p.r.q.v.u.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.s: G = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: H = None
        self.w: A = None
        self.v: B = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.u: G = None
        self.r: B = None
        self.o: E = None
        self.z: G = None
        self.p: E = None
        self.s: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: F = None
        self.txt = txt

a = A("a")
b = B("b")
m = C("m")
d = D("d")
e = E("e")
f = F("f")
c = G("c")
j = H("j")
i = G("i")

a.u = b
a.s = i
b.q = e
m.w = f
m.u = b
d.y = f
d.s = j
d.w = a
d.v = b
e.v = a
e.p = i
f.y = c
c.u = i
c.z = i
c.r = b
c.o = e
c.p = e
c.s = j
j.q = b
j.y = f
i.u = c
i.z = c
i.r = b
i.o = e
i.p = e
i.s = j
assert a.s.p.p.r.q.v.u.q.v.txt == "a"