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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: B = None
        self.s: G = None
        self.r: B = None
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: G = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

i = A("i")
l = B("l")
b = C("b")
a = D("a")
m = E("m")
j = F("j")
k = G("k")

i.u = m
i.x = l
l.s = i
l.u = a
l.t = j
b.v = a
b.q = l
b.r = l
b.s = k
b.x = i
a.s = i
m.x = a
m.y = k
m.s = l
j.s = i
j.u = k
j.z = m
k.x = a
assert m.y.x.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.q: B = None
        self.s: G = None
        self.r: B = None
        self.x: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.y: G = None
        self.s: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

i = A("i")
l = B("l")
b = C("b")
a = D("a")
m = E("m")
j = F("j")
k = G("k")

i.u = m
i.x = l
l.s = i
l.u = a
l.t = j
b.v = a
b.q = l
b.r = l
b.s = k
b.x = i
a.s = i
m.x = a
m.y = k
m.s = l
j.s = i
j.u = k
j.z = m
k.x = a
assert m.y.x.s.u.txt == "m"