class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: E = None
        self.x: E = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

c.s = g
c.z = b
c.x = b
c.u = a
e.q = m
e.v = f
e.w = f
f.q = a
a.s = j
a.r = e
b.s = e
b.x = f
b.v = f
b.q = c
l.w = e
m.s = f
m.z = b
m.x = b
m.u = a
j.s = f
j.z = b
j.x = b
j.u = a
g.q = a
assert m.s.q.s.z.x.q.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.z: E = None
        self.x: E = None
        self.u: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.q: D = None
        self.txt = txt

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

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

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

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

c.s = g
c.z = b
c.x = b
c.u = a
e.q = m
e.v = f
e.w = f
f.q = a
a.s = j
a.r = e
b.s = e
b.x = f
b.v = f
b.q = c
l.w = e
m.s = f
m.z = b
m.x = b
m.u = a
j.s = f
j.z = b
j.x = b
j.u = a
g.q = a
assert m.s.q.s.z.x.q.r.v.txt == "f"