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

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: C = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: C = None
        self.v: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.w: D = None
        self.s: C = None
        self.t: F = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.p: D = None
        self.y: C = None
        self.v: D = None
        self.txt = txt

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

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