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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: D = None
        self.s: E = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
e = C("e")
f = D("f")
g = E("g")
j = F("j")

m.r = g
m.x = j
m.u = e
i.r = j
e.v = j
e.o = f
e.s = g
f.x = g
g.w = f
g.s = f
g.q = i
j.q = e
j.r = e
j.p = g
assert g.q.r.r.o.txt == "
class A:
    def __init__(self, txt: str):
        self.r: E = None
        self.x: F = None
        self.u: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.o: D = None
        self.s: E = None
        self.txt = txt

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

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

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

m = A("m")
i = B("i")
e = C("e")
f = D("f")
g = E("g")
j = F("j")

m.r = g
m.x = j
m.u = e
i.r = j
e.v = j
e.o = f
e.s = g
f.x = g
g.w = f
g.s = f
g.q = i
j.q = e
j.r = e
j.p = g
assert g.q.r.r.o.txt == "f"