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

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

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

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

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

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

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

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

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

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

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

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

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

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

i.q = h
i.x = c
f.p = b
f.s = b
f.q = d
f.v = h
f.y = i
b.w = d
b.q = c
b.x = n
d.q = h
d.u = h
d.s = b
d.p = i
d.z = c
h.r = d
h.t = d
h.z = b
h.w = c
c.p = b
c.s = d
n.p = b
n.s = b
n.q = d
n.v = h
n.y = i
assert n.q.u.w.p.w.u.z.txt == "b"