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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: F = None
        self.txt = txt

g = A("g")
j = B("j")
e = C("e")
l = D("l")
h = E("h")
d = F("d")
m = F("m")

g.x = l
g.w = d
g.v = e
j.w = m
j.s = m
j.u = e
j.v = l
j.y = d
e.r = g
l.x = e
l.s = e
l.r = g
l.w = g
l.y = d
h.o = e
h.p = e
d.q = j
d.s = m
m.q = j
m.s = d
assert l.r.w.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: F = None
        self.v: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: F = None
        self.txt = txt

g = A("g")
j = B("j")
e = C("e")
l = D("l")
h = E("h")
d = F("d")
m = F("m")

g.x = l
g.w = d
g.v = e
j.w = m
j.s = m
j.u = e
j.v = l
j.y = d
e.r = g
l.x = e
l.s = e
l.r = g
l.w = g
l.y = d
h.o = e
h.p = e
d.q = j
d.s = m
m.q = j
m.s = d
assert l.r.w.s.txt == "m"