class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: D = None
        self.p: E = None
        self.w: D = None
        self.u: E = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: B = None
        self.r: F = None
        self.v: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.v: D = None
        self.p: E = None
        self.w: D = None
        self.u: E = None
        self.z: E = None
        self.q: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.r: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: A = None
        self.s: B = None
        self.r: F = None
        self.v: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.r: F = None
        self.txt = txt

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

i.r = d
i.u = g
l.o = m
l.v = m
l.w = m
l.q = m
l.p = e
l.u = e
l.z = e
g.x = e
g.r = d
m.x = i
m.s = l
m.r = a
m.v = e
e.y = i
e.p = i
e.q = f
d.o = i
d.x = f
d.v = g
d.q = m
d.z = a
f.y = i
f.r = d
a.o = i
a.x = f
a.v = g
a.q = m
a.z = d
h.o = m
h.v = m
h.w = m
h.q = m
h.p = e
h.u = e
h.z = e
assert a.v.x.y.r.txt == "d"