class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: E = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

m = A("m")
a = B("a")
e = C("e")
h = D("h")
g = E("g")
d = F("d")
i = A("i")

m.o = e
m.y = e
m.q = g
m.p = a
a.v = e
e.t = g
h.r = a
h.w = d
g.v = d
d.x = a
d.w = g
d.t = i
i.o = e
i.y = e
i.q = g
i.p = a
assert h.w.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.q: E = None
        self.y: C = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

m = A("m")
a = B("a")
e = C("e")
h = D("h")
g = E("g")
d = F("d")
i = A("i")

m.o = e
m.y = e
m.q = g
m.p = a
a.v = e
e.t = g
h.r = a
h.w = d
g.v = d
d.x = a
d.w = g
d.t = i
i.o = e
i.y = e
i.q = g
i.p = a
assert h.w.x.v.txt == "e"