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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: B = None
        self.s: D = None
        self.v: D = None
        self.x: A = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.s: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.q: B = None
        self.s: D = None
        self.v: D = None
        self.x: A = None
        self.txt = txt

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

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

d.q = b
d.p = n
d.u = l
c.s = i
n.u = g
f.s = n
f.v = g
f.w = b
e.y = d
e.x = d
e.q = c
e.s = g
e.v = f
l.w = c
g.s = n
g.v = f
g.w = d
b.q = d
b.p = n
b.u = l
m.s = i
i.y = d
i.x = d
i.q = c
i.s = f
i.v = g
assert c.s.s.w.p.u.w.u.w.s.txt == "i"