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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.r: C = None
        self.p: C = None
        self.w: A = 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.r: A = None
        self.q: A = None
        self.o: B = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: E = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.o: A = None
        self.x: A = None
        self.r: C = None
        self.p: C = None
        self.w: A = 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.r: A = None
        self.q: A = None
        self.o: B = None
        self.y: B = None
        self.p: D = None
        self.txt = txt

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

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