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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: E = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.v: G = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.p: C = None
        self.u: B = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

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

e.w = f
m.u = f
m.r = a
m.w = i
m.p = b
b.z = a
b.q = a
b.x = a
b.u = e
b.v = h
i.o = m
a.w = f
f.q = i
h.x = b
h.p = b
h.v = m
h.u = m
h.w = m
h.o = e
assert a.w.q.o.r.w.q.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.r: E = None
        self.w: D = None
        self.p: C = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: A = None
        self.v: G = None
        self.q: E = None
        self.x: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: C = None
        self.v: B = None
        self.p: C = None
        self.u: B = None
        self.o: A = None
        self.w: B = None
        self.txt = txt

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

e.w = f
m.u = f
m.r = a
m.w = i
m.p = b
b.z = a
b.q = a
b.x = a
b.u = e
b.v = h
i.o = m
a.w = f
f.q = i
h.x = b
h.p = b
h.v = m
h.u = m
h.w = m
h.o = e
assert a.w.q.o.r.w.q.txt == "i"