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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: C = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
b = C("b")
c = D("c")
j = E("j")
n = F("n")
m = A("m")
i = B("i")
l = A("l")

g.y = i
g.t = b
g.u = n
g.w = n
g.s = n
g.r = c
f.u = b
f.v = l
b.t = m
c.p = g
c.y = b
c.u = b
c.v = f
j.v = b
n.w = i
m.y = i
m.t = b
m.u = n
m.w = n
m.s = n
m.r = c
i.u = b
i.v = g
l.y = i
l.t = b
l.u = n
l.w = n
l.s = n
l.r = c
assert f.u.t.w.w.u.t.y.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.t: C = None
        self.u: F = None
        self.w: F = None
        self.s: F = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: C = None
        self.u: C = None
        self.v: B = None
        self.txt = txt

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

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

g = A("g")
f = B("f")
b = C("b")
c = D("c")
j = E("j")
n = F("n")
m = A("m")
i = B("i")
l = A("l")

g.y = i
g.t = b
g.u = n
g.w = n
g.s = n
g.r = c
f.u = b
f.v = l
b.t = m
c.p = g
c.y = b
c.u = b
c.v = f
j.v = b
n.w = i
m.y = i
m.t = b
m.u = n
m.w = n
m.s = n
m.r = c
i.u = b
i.v = g
l.y = i
l.t = b
l.u = n
l.w = n
l.s = n
l.r = c
assert f.u.t.w.w.u.t.y.u.t.txt == "m"