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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.p: F = None
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.v: B = None
        self.u: F = None
        self.txt = txt

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

g = A("g")
h = B("h")
f = C("f")
n = D("n")
i = E("i")
c = F("c")
l = B("l")
k = C("k")

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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.x: A = None
        self.p: F = None
        self.t: B = None
        self.w: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.t: B = None
        self.z: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.v: B = None
        self.u: F = None
        self.txt = txt

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

g = A("g")
h = B("h")
f = C("f")
n = D("n")
i = E("i")
c = F("c")
l = B("l")
k = C("k")

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