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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.r: A = None
        self.y: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.y: F = None
        self.p: D = None
        self.v: H = None
        self.u: D = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.r: A = None
        self.y: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

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

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

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

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

class H:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.txt = txt

class I:
    def __init__(self, txt: str):
        self.z: D = None
        self.o: B = None
        self.y: F = None
        self.p: D = None
        self.v: H = None
        self.u: D = None
        self.txt = txt

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

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