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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: A = None
        self.z: H = None
        self.y: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.s: A = None
        self.z: H = None
        self.y: I = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: E = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.y: E = None
        self.u: I = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.x: H = None
        self.txt = txt

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

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