class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.o: E = None
        self.s: E = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.y: D = None
        self.r: C = None
        self.o: E = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
h = C("h")
g = D("g")
b = E("b")
a = F("a")
i = C("i")

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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.x: A = None
        self.o: E = None
        self.s: E = None
        self.u: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.u: F = None
        self.y: D = None
        self.r: C = None
        self.o: E = None
        self.txt = txt

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

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

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

l = A("l")
d = B("d")
h = C("h")
g = D("g")
b = E("b")
a = F("a")
i = C("i")

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