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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.y: G = None
        self.v: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

l.u = m
l.w = n
b.s = m
i.r = c
i.o = c
i.q = c
n.v = c
c.q = b
c.s = l
d.y = a
d.v = a
a.y = l
h.r = c
h.o = c
h.q = c
m.s = b
assert c.s.u.s.s.s.s.txt == "m"