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

class B:
    def __init__(self, txt: str):
        self.z: I = None
        self.q: E = None
        self.r: A = None
        self.v: C = None
        self.p: C = None
        self.w: H = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.y: A = None
        self.u: E = None
        self.p: B = None
        self.t: H = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.z: I = None
        self.q: E = None
        self.r: A = None
        self.v: C = None
        self.p: C = None
        self.w: H = None
        self.u: G = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.s: E = None
        self.y: A = None
        self.u: E = None
        self.p: B = None
        self.t: H = None
        self.txt = txt

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

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

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

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

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