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

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: B = None
        self.q: F = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.txt = txt

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

d = A("d")
j = B("j")
l = C("l")
n = D("n")
b = E("b")
f = F("f")
i = C("i")
g = E("g")
c = B("c")

d.o = l
d.t = f
d.x = i
j.y = c
j.u = d
j.w = n
j.r = l
j.q = g
l.s = d
l.p = c
l.q = f
l.o = n
n.q = c
n.z = f
b.q = g
b.z = i
f.q = j
f.o = j
f.p = d
i.s = d
i.p = j
i.q = f
i.o = n
g.q = b
g.z = i
c.y = j
c.u = d
c.w = n
c.r = l
c.q = g
assert c.w.q.y.q.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: F = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: B = None
        self.q: F = None
        self.o: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: C = None
        self.txt = txt

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

d = A("d")
j = B("j")
l = C("l")
n = D("n")
b = E("b")
f = F("f")
i = C("i")
g = E("g")
c = B("c")

d.o = l
d.t = f
d.x = i
j.y = c
j.u = d
j.w = n
j.r = l
j.q = g
l.s = d
l.p = c
l.q = f
l.o = n
n.q = c
n.z = f
b.q = g
b.z = i
f.q = j
f.o = j
f.p = d
i.s = d
i.p = j
i.q = f
i.o = n
g.q = b
g.z = i
c.y = j
c.u = d
c.w = n
c.r = l
c.q = g
assert c.w.q.y.q.q.q.txt == "g"