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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: F = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

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

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

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

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

g = A("g")
b = B("b")
m = C("m")
j = D("j")
l = E("l")
i = F("i")

g.r = b
g.v = b
g.z = m
b.p = g
b.x = g
b.v = i
b.y = m
m.s = l
m.x = b
j.r = g
j.q = l
j.u = i
l.q = i
i.y = m
assert g.v.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: C = None
        self.v: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: F = None
        self.y: C = None
        self.x: A = None
        self.txt = txt

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

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

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

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

g = A("g")
b = B("b")
m = C("m")
j = D("j")
l = E("l")
i = F("i")

g.r = b
g.v = b
g.z = m
b.p = g
b.x = g
b.v = i
b.y = m
m.s = l
m.x = b
j.r = g
j.q = l
j.u = i
l.q = i
i.y = m
assert g.v.v.y.txt == "m"