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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: G = None
        self.p: A = None
        self.o: D = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: C = None
        self.txt = txt

d = A("d")
e = B("e")
a = C("a")
f = D("f")
k = E("k")
c = F("c")
b = G("b")
n = B("n")
h = G("h")

d.u = n
e.q = d
e.r = d
e.u = a
e.w = c
e.z = f
a.u = e
a.w = h
a.p = d
a.z = d
a.o = f
a.x = f
f.z = d
f.q = e
f.s = k
k.o = b
k.q = c
c.q = a
c.x = a
b.o = f
b.v = a
n.q = d
n.r = d
n.u = a
n.w = c
n.z = f
h.o = f
h.v = a
assert b.v.u.w.q.z.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.w: G = None
        self.p: A = None
        self.o: D = None
        self.z: A = None
        self.x: D = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: C = None
        self.txt = txt

d = A("d")
e = B("e")
a = C("a")
f = D("f")
k = E("k")
c = F("c")
b = G("b")
n = B("n")
h = G("h")

d.u = n
e.q = d
e.r = d
e.u = a
e.w = c
e.z = f
a.u = e
a.w = h
a.p = d
a.z = d
a.o = f
a.x = f
f.z = d
f.q = e
f.s = k
k.o = b
k.q = c
c.q = a
c.x = a
b.o = f
b.v = a
n.q = d
n.r = d
n.u = a
n.w = c
n.z = f
h.o = f
h.v = a
assert b.v.u.w.q.z.u.u.txt == "a"