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

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: E = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

b = A("b")
m = B("m")
h = C("h")
k = D("k")
d = E("d")
i = F("i")

b.q = h
b.x = i
m.o = d
h.x = d
h.s = d
h.y = k
k.r = d
k.q = d
k.o = i
k.x = b
k.w = b
k.s = m
d.y = h
i.q = h
i.x = h
i.t = k
i.w = b
assert d.y.y.q.y.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.x: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.s: E = None
        self.y: D = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

b = A("b")
m = B("m")
h = C("h")
k = D("k")
d = E("d")
i = F("i")

b.q = h
b.x = i
m.o = d
h.x = d
h.s = d
h.y = k
k.r = d
k.q = d
k.o = i
k.x = b
k.w = b
k.s = m
d.y = h
i.q = h
i.x = h
i.t = k
i.w = b
assert d.y.y.q.y.y.r.txt == "d"