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

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: C = None
        self.u: E = None
        self.q: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.z: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: A = None
        self.w: C = None
        self.u: E = None
        self.q: H = None
        self.txt = txt

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

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

class H:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

f.q = e
f.p = i
c.q = n
c.v = f
b.y = f
b.r = f
b.q = l
b.o = a
b.t = e
b.u = n
b.s = m
m.z = d
a.s = f
a.w = b
a.u = e
a.q = l
i.p = c
d.x = f
d.y = i
d.o = i
l.y = b
n.q = c
n.v = f
e.s = f
e.w = b
e.u = a
e.q = l
assert b.u.v.q.u.s.p.p.v.q.s.txt == "f"