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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: D = None
        self.r: B = None
        self.w: E = None
        self.y: B = None
        self.txt = txt

k = A("k")
e = B("e")
b = C("b")
f = D("f")
g = E("g")
j = F("j")
l = F("l")
c = B("c")

k.v = e
e.v = b
b.w = g
f.x = g
f.w = g
g.w = k
j.u = b
j.o = f
j.r = e
j.y = e
j.w = g
l.u = b
l.o = f
l.r = e
l.y = e
l.w = g
c.v = b
assert g.w.v.v.w.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: D = None
        self.r: B = None
        self.w: E = None
        self.y: B = None
        self.txt = txt

k = A("k")
e = B("e")
b = C("b")
f = D("f")
g = E("g")
j = F("j")
l = F("l")
c = B("c")

k.v = e
e.v = b
b.w = g
f.x = g
f.w = g
g.w = k
j.u = b
j.o = f
j.r = e
j.y = e
j.w = g
l.u = b
l.o = f
l.r = e
l.y = e
l.w = g
c.v = b
assert g.w.v.v.w.txt == "g"