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

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: C = None
        self.y: D = None
        self.q: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: F = None
        self.txt = txt

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

m.v = d
m.x = b
m.r = j
c.p = j
c.x = j
c.y = j
c.v = d
c.w = g
l.v = j
j.r = b
g.o = b
g.z = i
g.y = j
g.q = d
b.x = i
d.u = j
d.p = b
i.v = j
e.o = b
e.z = l
e.y = j
e.q = d
a.p = j
a.x = j
a.y = j
a.v = d
a.w = g
assert a.w.z.v.r.x.v.r.x.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: G = None
        self.x: F = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: C = None
        self.y: D = None
        self.q: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: C = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.u: D = None
        self.p: F = None
        self.txt = txt

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

m.v = d
m.x = b
m.r = j
c.p = j
c.x = j
c.y = j
c.v = d
c.w = g
l.v = j
j.r = b
g.o = b
g.z = i
g.y = j
g.q = d
b.x = i
d.u = j
d.p = b
i.v = j
e.o = b
e.z = l
e.y = j
e.q = d
a.p = j
a.x = j
a.y = j
a.v = d
a.w = g
assert a.w.z.v.r.x.v.r.x.v.r.txt == "b"