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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: G = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.p: D = None
        self.q: C = None
        self.r: C = None
        self.u: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: C = None
        self.u: E = None
        self.v: F = None
        self.t: E = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
d = D("d")
c = E("c")
a = F("a")
h = G("h")
k = E("k")

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

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

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

class D:
    def __init__(self, txt: str):
        self.s: C = None
        self.v: G = None
        self.o: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.y: C = None
        self.p: D = None
        self.q: C = None
        self.r: C = None
        self.u: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.z: F = None
        self.s: C = None
        self.u: E = None
        self.v: F = None
        self.t: E = None
        self.txt = txt

g = A("g")
i = B("i")
f = C("f")
d = D("d")
c = E("c")
a = F("a")
h = G("h")
k = E("k")

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