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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: C = None
        self.p: G = None
        self.v: E = None
        self.x: A = None
        self.txt = txt

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

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

e.x = b
d.r = a
d.u = a
d.x = k
d.y = e
d.s = b
a.y = d
b.q = a
k.y = h
k.r = a
k.p = m
h.r = m
h.v = m
h.t = a
h.p = i
h.x = e
c.v = m
m.y = h
m.r = a
m.p = k
i.v = m
assert b.q.y.r.y.y.x.q.y.s.txt == "
class A:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: C = None
        self.p: G = None
        self.v: E = None
        self.x: A = None
        self.txt = txt

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

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

e.x = b
d.r = a
d.u = a
d.x = k
d.y = e
d.s = b
a.y = d
b.q = a
k.y = h
k.r = a
k.p = m
h.r = m
h.v = m
h.t = a
h.p = i
h.x = e
c.v = m
m.y = h
m.r = a
m.p = k
i.v = m
assert b.q.y.r.y.y.x.q.y.s.txt == "b"