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

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: E = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
c = C("c")
a = D("a")
f = E("f")
i = F("i")

g.u = e
g.x = i
g.z = c
e.y = f
e.r = c
c.y = i
a.p = g
a.s = f
f.w = c
f.r = c
f.q = e
i.s = a
i.v = f
assert c.y.v.q.r.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.x: F = None
        self.z: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: A = None
        self.s: E = None
        self.txt = txt

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

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

g = A("g")
e = B("e")
c = C("c")
a = D("a")
f = E("f")
i = F("i")

g.u = e
g.x = i
g.z = c
e.y = f
e.r = c
c.y = i
a.p = g
a.s = f
f.w = c
f.r = c
f.q = e
i.s = a
i.v = f
assert c.y.v.q.r.y.v.txt == "f"