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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: F = None
        self.o: F = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.s: F = None
        self.v: F = None
        self.o: F = None
        self.w: E = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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