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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.v: E = None
        self.r: E = None
        self.txt = txt

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

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

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

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