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

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

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

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

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

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

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

m = A("m")
c = B("c")
n = C("n")
f = D("f")
h = E("h")
d = F("d")
e = G("e")
i = C("i")
j = B("j")
g = E("g")

m.t = h
c.r = j
c.x = m
n.o = g
n.s = d
n.w = d
n.u = f
n.p = f
f.q = e
h.q = e
d.r = i
d.w = i
d.y = f
d.t = n
e.w = d
i.o = h
i.s = d
i.w = d
i.u = f
i.p = f
j.r = c
j.x = m
g.q = e
assert h.q.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

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

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

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

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

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

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

m = A("m")
c = B("c")
n = C("n")
f = D("f")
h = E("h")
d = F("d")
e = G("e")
i = C("i")
j = B("j")
g = E("g")

m.t = h
c.r = j
c.x = m
n.o = g
n.s = d
n.w = d
n.u = f
n.p = f
f.q = e
h.q = e
d.r = i
d.w = i
d.y = f
d.t = n
e.w = d
i.o = h
i.s = d
i.w = d
i.u = f
i.p = f
j.r = c
j.x = m
g.q = e
assert h.q.w.t.txt == "n"