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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.s: C = None
        self.z: B = None
        self.y: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: A = None
        self.s: E = None
        self.z: F = None
        self.txt = txt

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: C = None
        self.s: C = None
        self.z: B = None
        self.y: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: A = None
        self.s: E = None
        self.z: F = None
        self.txt = txt

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

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

k.u = g
k.r = b
n.r = l
n.y = l
n.v = d
n.s = d
n.z = g
d.x = b
e.w = d
h.r = e
h.x = k
h.s = a
h.z = l
l.v = b
l.q = e
l.x = n
l.t = d
b.w = d
a.r = e
a.x = k
a.s = c
a.z = l
c.r = b
c.x = k
c.s = h
c.z = l
g.r = l
g.y = l
g.v = d
g.s = d
g.z = n
assert l.q.w.x.w.x.w.x.w.txt == "d"