class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: B = None
        self.w: D = None
        self.s: A = None
        self.y: G = None
        self.p: G = 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.r: H = None
        self.y: G = None
        self.q: B = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.w: B = None
        self.r: C = None
        self.o: E = None
        self.t: B = None
        self.txt = txt

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

l = A("l")
j = B("j")
a = C("a")
d = D("d")
f = E("f")
g = F("g")
h = G("h")
m = H("m")
i = F("i")
b = B("b")

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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.o: B = None
        self.w: D = None
        self.s: A = None
        self.y: G = None
        self.p: G = 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.r: H = None
        self.y: G = None
        self.q: B = None
        self.o: D = None
        self.p: F = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.y: H = None
        self.w: B = None
        self.r: C = None
        self.o: E = None
        self.t: B = None
        self.txt = txt

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

l = A("l")
j = B("j")
a = C("a")
d = D("d")
f = E("f")
g = F("g")
h = G("h")
m = H("m")
i = F("i")
b = B("b")

l.p = a
j.x = a
a.t = g
a.o = j
a.w = d
a.s = l
a.y = h
a.p = h
d.r = i
f.r = m
f.y = h
f.q = j
f.o = d
f.p = g
g.v = f
g.t = d
h.y = m
h.w = b
h.r = a
h.o = f
h.t = j
m.v = b
i.v = f
i.t = d
b.x = a
assert i.t.r.t.txt == "d"