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

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

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

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

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

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

m = A("m")
f = B("f")
l = C("l")
d = D("d")
n = E("n")
i = F("i")
b = E("b")
a = B("a")
e = C("e")
g = F("g")

m.u = i
f.v = e
l.v = n
l.y = m
l.p = m
d.y = f
d.t = f
d.v = i
d.r = n
d.o = b
n.s = m
n.r = b
n.t = l
i.p = a
i.s = m
i.v = e
i.y = f
i.u = d
b.s = m
b.r = n
b.t = e
a.v = e
e.v = b
e.y = m
e.p = m
g.p = a
g.s = m
g.v = l
g.y = f
g.u = d
assert g.s.u.s.u.s.u.s.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.txt = txt

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

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

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

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

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

m = A("m")
f = B("f")
l = C("l")
d = D("d")
n = E("n")
i = F("i")
b = E("b")
a = B("a")
e = C("e")
g = F("g")

m.u = i
f.v = e
l.v = n
l.y = m
l.p = m
d.y = f
d.t = f
d.v = i
d.r = n
d.o = b
n.s = m
n.r = b
n.t = l
i.p = a
i.s = m
i.v = e
i.y = f
i.u = d
b.s = m
b.r = n
b.t = e
a.v = e
e.v = b
e.y = m
e.p = m
g.p = a
g.s = m
g.v = l
g.y = f
g.u = d
assert g.s.u.s.u.s.u.s.txt == "m"