class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: B = None
        self.p: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: F = None
        self.v: B = None
        self.p: F = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: C = None
        self.v: F = None
        self.z: D = None
        self.q: F = None
        self.t: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
a = C("a")
b = D("b")
e = E("e")
i = F("i")
h = A("h")
g = E("g")

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: F = None
        self.u: F = None
        self.v: B = None
        self.p: F = None
        self.r: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.o: C = None
        self.v: F = None
        self.z: D = None
        self.q: F = None
        self.t: C = None
        self.txt = txt

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

k = A("k")
n = B("n")
a = C("a")
b = D("b")
e = E("e")
i = F("i")
h = A("h")
g = E("g")

k.r = g
k.t = n
k.p = a
n.p = i
n.x = i
n.q = i
n.t = b
a.q = i
a.p = b
a.u = b
a.w = n
b.w = i
b.u = i
b.p = i
b.v = n
b.r = n
e.s = b
e.z = b
e.o = a
e.t = a
e.v = i
e.q = i
i.w = a
h.r = e
h.t = n
h.p = a
g.s = b
g.z = b
g.o = a
g.t = a
g.v = i
g.q = i
assert n.q.w.q.w.txt == "a"