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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.w: C = None
        self.s: C = None
        self.o: C = None
        self.p: A = None
        self.txt = txt

l = A("l")
i = B("i")
g = C("g")
m = D("m")
n = E("n")
h = F("h")

l.y = m
l.u = m
l.w = m
l.r = m
l.x = i
i.w = m
i.q = g
i.r = l
i.x = l
g.w = h
m.s = i
m.y = n
m.u = g
n.s = m
n.x = h
n.p = g
n.r = l
h.v = l
h.u = l
h.p = l
h.w = g
h.s = g
h.o = g
assert m.u.w.o.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.x: B = None
        self.u: D = None
        self.w: D = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: A = None
        self.w: C = None
        self.s: C = None
        self.o: C = None
        self.p: A = None
        self.txt = txt

l = A("l")
i = B("i")
g = C("g")
m = D("m")
n = E("n")
h = F("h")

l.y = m
l.u = m
l.w = m
l.r = m
l.x = i
i.w = m
i.q = g
i.r = l
i.x = l
g.w = h
m.s = i
m.y = n
m.u = g
n.s = m
n.x = h
n.p = g
n.r = l
h.v = l
h.u = l
h.p = l
h.w = g
h.s = g
h.o = g
assert m.u.w.o.w.u.txt == "l"