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

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.z: D = None
        self.p: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.o: H = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: H = None
        self.y: C = None
        self.s: F = None
        self.r: H = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

c = A("c")
j = B("j")
i = C("i")
d = D("d")
g = E("g")
l = F("l")
e = G("e")
n = H("n")

c.u = n
c.w = l
j.w = d
j.x = d
j.v = c
i.o = n
i.p = n
i.z = d
d.p = g
d.x = g
d.u = g
d.o = n
d.y = j
g.x = i
g.y = i
g.u = n
g.r = n
g.w = n
g.s = l
l.x = i
l.o = c
l.u = e
e.q = i
e.v = n
n.r = g
assert d.o.r.y.z.y.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: H = None
        self.w: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.o: H = None
        self.z: D = None
        self.p: H = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: E = None
        self.x: E = None
        self.o: H = None
        self.u: E = None
        self.y: B = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: C = None
        self.u: H = None
        self.y: C = None
        self.s: F = None
        self.r: H = None
        self.w: H = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.q: C = None
        self.v: H = None
        self.txt = txt

class H:
    def __init__(self, txt: str):
        self.r: E = None
        self.txt = txt

c = A("c")
j = B("j")
i = C("i")
d = D("d")
g = E("g")
l = F("l")
e = G("e")
n = H("n")

c.u = n
c.w = l
j.w = d
j.x = d
j.v = c
i.o = n
i.p = n
i.z = d
d.p = g
d.x = g
d.u = g
d.o = n
d.y = j
g.x = i
g.y = i
g.u = n
g.r = n
g.w = n
g.s = l
l.x = i
l.o = c
l.u = e
e.q = i
e.v = n
n.r = g
assert d.o.r.y.z.y.x.txt == "d"