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

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.txt = txt

b = A("b")
f = B("f")
c = C("c")
m = D("m")
d = E("d")
a = F("a")
n = G("n")
l = B("l")

b.u = m
f.u = c
f.o = a
c.p = a
c.s = a
c.u = l
c.y = m
m.y = b
m.p = b
m.v = d
m.s = d
d.s = m
d.z = a
a.u = b
a.r = m
a.w = m
a.t = c
n.o = l
n.v = m
l.u = c
l.o = a
assert f.o.u.u.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.s: D = None
        self.z: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: D = None
        self.txt = txt

b = A("b")
f = B("f")
c = C("c")
m = D("m")
d = E("d")
a = F("a")
n = G("n")
l = B("l")

b.u = m
f.u = c
f.o = a
c.p = a
c.s = a
c.u = l
c.y = m
m.y = b
m.p = b
m.v = d
m.s = d
d.s = m
d.z = a
a.u = b
a.r = m
a.w = m
a.t = c
n.o = l
n.v = m
l.u = c
l.o = a
assert f.o.u.u.y.u.txt == "m"