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

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.s: E = None
        self.z: F = None
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: D = None
        self.q: A = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: E = None
        self.q: E = None
        self.t: C = None
        self.y: C = None
        self.txt = txt

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

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

a.r = h
a.q = j
a.o = i
d.t = c
h.v = d
h.w = i
h.s = c
h.z = m
h.t = l
j.u = a
j.t = d
j.q = l
c.s = d
c.t = j
c.q = i
c.u = h
c.v = h
m.s = d
m.w = c
m.q = c
m.t = h
m.y = h
l.p = j
i.r = h
i.q = j
i.o = a
assert d.t.s.t.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.q: D = None
        self.o: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.s: E = None
        self.z: F = None
        self.t: G = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: D = None
        self.q: A = None
        self.u: C = None
        self.v: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.s: B = None
        self.w: E = None
        self.q: E = None
        self.t: C = None
        self.y: C = None
        self.txt = txt

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

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

a.r = h
a.q = j
a.o = i
d.t = c
h.v = d
h.w = i
h.s = c
h.z = m
h.t = l
j.u = a
j.t = d
j.q = l
c.s = d
c.t = j
c.q = i
c.u = h
c.v = h
m.s = d
m.w = c
m.q = c
m.t = h
m.y = h
l.p = j
i.r = h
i.q = j
i.o = a
assert d.t.s.t.txt == "c"