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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: F = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: C = None
        self.o: A = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: A = None
        self.q: F = None
        self.z: E = None
        self.t: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.t: D = None
        self.s: C = None
        self.o: A = None
        self.w: D = None
        self.y: E = None
        self.txt = txt

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

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

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

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

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